Need advices for "linear leds"

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Message
Author
oscarDelta77
Posts: 57
Joined: Sat Nov 26, 2016 9:58 pm

Re: Need advices for "linear leds"

#11 Post by oscarDelta77 »

Because each of them will be "switched on or off" if needed.

It will be the same for RPM, Oil press, Temp press and some other more.

Is there another way to do this ?

Edit : For Amperes :

If Amps value is < 60, then green leds will be on, depending the value from 0 to 59.

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Need advices for "linear leds"

#12 Post by Ralph »

Why not draw a shape in the canvas and set the opacity with the fill?
http://siminnovations.com/wiki/index.php?title=Fill

oscarDelta77
Posts: 57
Joined: Sat Nov 26, 2016 9:58 pm

Re: Need advices for "linear leds"

#13 Post by oscarDelta77 »

I will try and let you know !

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Need advices for "linear leds"

#14 Post by Keith Baxter »

Hi,
Try this.

Code: Select all

-- initalise your canvas
led = canvas_add(0, 0, 512, 512)

--This is the value coming from the sin
sim_value1=10
sim_value2=5
--Place the canvas_draw() inside the dataref subscribe. When the value of <sim_value> changes the number of LED's lit will change.

canvas_draw(led, function()
  for i=1,sim_value1 do
  _rect(0+(i*30),5,20,50,10)
    if i <= 3 then 
       _fill("red")
    else 
       _fill("green")
    end	   
  end
  
  for i1=1,sim_value2 do
  _rect(0+(i1*30),100,20,50,10)
    if i1 <= 1 then 
       _fill("red")
    elseif i1 > 1 and i1 < 3 then 	
       _fill("yellow")
    else	   
       _fill("green")
    end	   
  end  
  
end)
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

oscarDelta77
Posts: 57
Joined: Sat Nov 26, 2016 9:58 pm

Re: Need advices for "linear leds"

#15 Post by oscarDelta77 »

Keith, thank you !

Based on your code it's working as i wanted !

As you can see, leds are off and are visible. And 6 green leds are on.

Image

Thank you again for your help and your time.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Need advices for "linear leds"

#16 Post by Keith Baxter »

oscarDelta77 wrote: Wed Dec 01, 2021 9:18 pm Keith, thank you !

Based on your code it's working as i wanted !

As you can see, leds are off and are visible. And 6 green leds are on.

Image

Thank you again for your help and your time.
Hi,

Awesome, that is great and looking good. Glad the code helped point you in the right direction. Just shout should you need other pointers. :D

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Need advices for "linear leds"

#17 Post by jph »

@Keith Baxter
Hi Keith, you are a veritable wizard with the 'Canvas' functions. Nice one. :D
Joe
Joe. CISSP, MSc.

oscarDelta77
Posts: 57
Joined: Sat Nov 26, 2016 9:58 pm

Re: Need advices for "linear leds"

#18 Post by oscarDelta77 »

I agree ! ;)

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Need advices for "linear leds"

#19 Post by Keith Baxter »

Too kind guys,

Thank you.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

oscarDelta77
Posts: 57
Joined: Sat Nov 26, 2016 9:58 pm

Re: Need advices for "linear leds"

#20 Post by oscarDelta77 »

Hi,

Almost finished fo these ones :

Image

CT & GT values does not exist; so i will find a rule.

Again, thanks for your great help.

Post Reply