Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Turn on user Led ?

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

questuk
Posts: 2
Joined: Thu 14 Feb 2013 1:25 pm
Weather Station: x
Operating System: x
Location: x

Turn on user Led ?

Post by questuk »

Hi,

Apolgies if this is the wrong forum, bit I have scoured the internet and cannot find another forum that deals with steelseries canvas gauges?

If it is the wrong forum can anyone suggest a place I can ask this question.

I am trying to turn on or make it blink the used led, I am using javascript (I am not using Sandysoft software) as this is actually going to be used in monitoring my temperatures in my home via javascript. Here is my attemp so far, any ideas would be welcome as I have spent many hours trying to find the answer in steelseries.js

Thanks in anticipation :D

Gary

Code: Select all

var radial3;
 
function init()

 {
	 // Define some sections
	 var sections = [steelseries.Section(0, 25, 'rgba(0, 0, 220, 0.3)'),
	 steelseries.Section(25, 50, 'rgba(0, 220, 0, 0.3)'),
	 steelseries.Section(50, 75, 'rgba(220, 220, 0, 0.3)')],

		 
         // Define one area
         areas = [steelseries.Section(75, 100, 'rgba(220, 0, 0, 0.3)')],

		 
         // Define value gradient for bargraph
         valGrad = new steelseries.gradientWrapper(0,
         100, [0, 0.33, 0.66, 0.85, 1], [new steelseries.rgbaColor(0, 0, 200, 1),
         new steelseries.rgbaColor(0, 200, 0, 1),
         new steelseries.rgbaColor(200, 200, 0, 1),
         new steelseries.rgbaColor(200, 0, 0, 1),
         new steelseries.rgbaColor(200, 0, 0, 1)]);
 
		

	 // Create a radial bargraph gauge
	 radial3 = new steelseries.RadialBargraph('canvas3', {
         gaugeType: steelseries.GaugeType.TYPE3,
         size: 201,
         section: sections,
         useSectionColors: true,
         titleString: 'Title',
         unitString: 'Section',
		
	 userLedColor: steelseries.LedColor.BLUE_LED, 
		
	 userLedVisible:true,
	
	 userLedON:false,	      // Not sure if this is correct ?
		
	 userLedBlinking:true, // Not sure if this is correct ?
		
		 });

User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Turn on user Led ?

Post by mcrossley »

No, the only initialisation parameters are userLedColor and userLedVisible.

To control the led you use the xxxUserLed methods...

radial3.setUserLedColor(steelseries.LedColor newLedColor);
radial3.toggleUserLed();
radial3.setUserLedOnOff(bool on);
radial3.blinkUserLed(bool blink)
questuk
Posts: 2
Joined: Thu 14 Feb 2013 1:25 pm
Weather Station: x
Operating System: x
Location: x

Re: Turn on user Led ?

Post by questuk »

Hi Mark,

Thanks for that worked a treat !

Regards

Gary
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Turn on user Led ?

Post by gwheelo »

No, the only initialisation parameters are userLedColor and userLedVisible.

To control the led you use the xxxUserLed methods...

radial3.setUserLedColor(steelseries.LedColor newLedColor);
radial3.toggleUserLed();
radial3.setUserLedOnOff(bool on);
radial3.blinkUserLed(bool blink)
OK - all the above is working for me - but how do I remove the userLed - for instance with the Temp gauge - show the userLED when the temp gauge is in "out" mode - but I would like to remove it when the"in" button is clicked - as the trend indicator is removed in "in" mode and appears in "out" mode. So far I am able to show(initialize), turn on/off, blink on/off, and set the color - but not able to "un-show".

Any suggestions.

George Wheelock
Image
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Turn on user Led ?

Post by mcrossley »

Not at present no, the visibility of both the threshold and user LEDs are set at initialisation, there are no public methods for toggling the visibility. It would be trivial to add this functionality though.

Maybe I'll sneak it in to the next release along with rising/falling thresholds. ;)
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Turn on user Led ?

Post by gwheelo »

Not at present no, the visibility of both the threshold and user LEDs are set at initialisation, there are no public methods for toggling the visibility. It would be trivial to add this functionality though.
Well that makes me feel a lot better - no wonder I couldn't figure out hoe to do it. Looking forward down the road to the next release!

Thanks!

GW
Image
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Turn on user Led ?

Post by gwheelo »

I couldn't figure out hoe to do it.
I spell about as well as I do javascript! :oops:

GW
Image
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Turn on user Led ?

Post by mcrossley »

George

Have a look at SteelSeries library v0.14.0 ;) - that should keep you busy for a while.
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Turn on user Led ?

Post by gwheelo »

Have a look at SteelSeries library v0.14.0
Yes, indeed, works like a charm - although right now there is nothing in range to fire off setUserLedVisible(T/F) - so you have to take my word for it. I use it in both the "Temp" and "Hum" gauges. Can we expect this to be added to the next Steelseries Cumulus release?

I will most likely also use this in the "Wind" gauge.

http://www.wheelocknet.net/cumulus/gaugesLED_14.html?gb

Thanks, as always,

George Wheelock
Image
myeager1967
Posts: 5
Joined: Tue 28 May 2013 2:15 am
Weather Station: Oregon Scientific
Operating System: Windows XP SP3
Location: Florida

Re: Turn on user Led ?

Post by myeager1967 »

I haven't made the leap to Cumulus as of yet but I am trying to figure out the SteelSeries gauges. I'm tearing apart every script I can find and found this forum. Here's the code I have right now and it simply won"t turn on the user LED. I'm sure it's my code but for the life of me I can't figure it out. Very new to HTML and JavaScript so I'll be looking for information next on conditional statements in JavaScript. I'm sure I'll be able to figure it out from looking at other code as that's pretty much how I'm learning C++. Any help on getting the trend indicator working would be appreciated as well....

Code follows...

<head>
<title>Pool Guages</title>
</head>
<body onload=init()>
<table><tbody><tr><td width="100%">
<canvas id=clockCanvas width=200 height=300>No canvas in your browser...sorry...</canvas>
<canvas id=powerCanvas width=200 height=300></canvas>
<canvas id=tempCanvas width=200 height=300></canvas>
<canvas id=diffCanvas width=200 height=300></canvas>
</td></tr></tbody></table>
</body>
<!-- http://emoncms.org/feed/value.json?id=8387 -->
<script>
function init()
{
// Initialzing gauges
// First the outside temp gauge


outsideGauge = new steelseries.Radial('powerCanvas', {
gaugeType: steelseries.GaugeType.TYPE4,
minValue:-10,
maxValue:110,
size: 200,
frameDesign: steelseries.FrameDesign.BRASS,
knobStyle: steelseries.KnobStyle.BRASS,
pointerType: steelseries.PointerType.TYPE6,
backgroundColor: steelseries.BackgroundColor.CARBON,
lcdDecimals: 2,
section: null,
area: null,
titleString: 'Outside Temp',
unitString: '°F',
minMeasuredValueVisible: true,
maxMeasuredValueVisible: true,
threshold: 100,
lcdVisible: true
});


pooltempGauge = new steelseries.Radial('tempCanvas', {
gaugeType: steelseries.GaugeType.TYPE4,
minValue:60,
maxValue:100,
size: 200,
frameDesign: steelseries.FrameDesign.BRASS,
knobStyle: steelseries.KnobStyle.BRASS,
pointerType: steelseries.PointerType.TYPE6,
backgroundColor: steelseries.BackgroundColor.CARBON,
section: null,
lcdDecimals: 2,
area: null,
titleString: 'Pool Temp',
unitString: '°F',
threshold: 87,
lcdVisible: true
});


differentialGauge = new steelseries.Radial('diffCanvas', {
gaugeType: steelseries.GaugeType.TYPE4,
minValue:-20,
maxValue:160,
size: 200,
frameDesign: steelseries.FrameDesign.BRASS,
knobStyle: steelseries.KnobStyle.BRASS,
pointerType: steelseries.PointerType.TYPE6,
backgroundColor: steelseries.BackgroundColor.CARBON,
section: null,
lcdDecimals: 2,
area: null,
titleString: 'Differential',
unitString: '°F',
minMeasuredValueVisible: true,
maxMeasuredValueVisible: true,
userLedColor: steelseries.LedColor.RED_LED,
userLedVisible: true,
threshold: 4,
lcdVisible: true
});


myClock = new steelseries.Clock('clockCanvas', {
gaugeType: steelseries.GaugeType.TYPE4,
minValue:0,
maxValue:140,
size: 200,
frameDesign: steelseries.FrameDesign.BRASS,
knobStyle: steelseries.KnobStyle.BRASS,
pointerType: steelseries.PointerType.TYPE1,
backgroundColor: steelseries.BackgroundColor.CARBON,
timeZoneOffsetHour: -5,
section: null,
area: null
});

// Start the gauge update
(function showIt(){
var saveit;
var site =

"http://api.pachube.com/v2/feeds/1098239238.json?&key=GtGuoMKJSqv2tzqGvWaITLhlEDUxrYXSixqPSmlyj-s&&datastreams=0,2,5";
//alert('going for ' + site);
$.ajax({
type: 'GET',
url: site,
dataType: 'json',
cache: false,
data: {},
processData: true,
async: false, // you have to have this so the data will arrive before display
success: function(data_archive) {
//alert("the url returned success");
//alert("got back " + data_archive.datastreams[0].current_value);
outsideGauge.setValueAnimated(eval(saveit=data_archive.datastreams[0].current_value));
pooltempGauge.setValueAnimated(eval(data_archive.datastreams[1].current_value));
differentialGauge.setValueAnimated(eval(data_archive.datastreams[2].current_value));


//differentialGuage.toggleUserLed();
differentialGuage.setUserLedOnOff(true);
differentialGuage.blinkUserLed(true);


},
error: function(a){
//alert("here I am in the error routine");
}
});
//tempGauge.setValueAnimated(75);
//alert('after the get ' + saveit);



setTimeout(showIt, 5000);
})();
}
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type=text/javascript src=http://dl.dropbox.com/u/88021870/SteelSeries/tween-min.js></script>
<script type=text/javascript src=http://dl.dropbox.com/u/88021870/SteelSeries/steelseries-min.js></script>
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Turn on user Led ?

Post by mcrossley »

Can you post a link to a page where is is actually running?
myeager1967
Posts: 5
Joined: Tue 28 May 2013 2:15 am
Weather Station: Oregon Scientific
Operating System: Windows XP SP3
Location: Florida

Re: Turn on user Led ?

Post by myeager1967 »

Right now it's only running on my local PC. I can post the HTML that calls it though. The code posted above runs on it's own on my machine but may not anywhere else. I'll post the bit of code that displays it. It's not very much....

<head>
<title>Home Monitor</title>
</head>
<body>
<body bgcolor="#666666">
<center>
<iframe width="840" height="215" scrolling="No" seamless frameBorder="0"

src="http://dl.dropbox.com/u/88021870/PoolGuage.htm"> </iframe>

<iframe width="640" height="215" scrolling="No" seamless frameBorder="0"

src="http://dl.dropbox.com/u/88021870/MasterBedroomGuage.htm"> </iframe>

</center>

</body>
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Turn on user Led ?

Post by mcrossley »

I just looked at the pool gauge page, my comment would be - how do you spell gauge?

Code: Select all

differentialGuage.setUserLedOnOff(true);
myeager1967
Posts: 5
Joined: Tue 28 May 2013 2:15 am
Weather Station: Oregon Scientific
Operating System: Windows XP SP3
Location: Florida

Re: Turn on user Led ?

Post by myeager1967 »

Well, that's what I get for trying to do things when I'm tired. I managed to get the LED to turn on, off and blink. Now I'm trying to figure out how to (if possible) change the LED color on the fly...
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Turn on user Led ?

Post by gwheelo »

My code is never a good model to use but this is how I am changing the UerLed color:

if (_temp.selected === 'out') {
//alert(tempBase);
_gaugeTemp.setUserLedVisible(true);
if (_gaugeTemp.setUserLedOnOff)
{
if(tempBase <=0)
{
_gaugeTemp.setUserLedOnOff(true);
_gaugeTemp.setUserLedColor(steelseries.LedColor.BLUE_LED);
_gaugeTemp.blinkUserLed(true);
}
else if(tempBase >=40)
{
_gaugeTemp.setUserLedOnOff(true);
_gaugeTemp.setUserLedColor(steelseries.LedColor.RED_LED);
_gaugeTemp.blinkUserLed(true);
}
else if(tempBase >=35)
{
_gaugeTemp.setUserLedOnOff(true);
_gaugeTemp.setUserLedColor(steelseries.LedColor.ORANGE_LED);
_gaugeTemp.blinkUserLed(true);
}
else
{
_gaugeTemp.setUserLedVisible(false);

}
} //end if

gwheelo
http://www.wheelocknet.net/cumulus/gauges.html?gb
Image
Post Reply