I have this RGB 5050 LED trip. Im currently using this with an Arduino board and Johnny-Five platform because I need to use Javascript to control it. I want to make the LED blink on a certain frequency and this will increase slowly.
For a single color LED, they have this command:
led.fade(brightness, ms)
but this doesn't work for RGB LED (what is just stupid).
The only option that I've found is this:
function FadeIN(){
led.intensity(i);
i++;
if(i < 100){
setTimeout( FadeIN, (Timer[y]/20));
}
}
This is a loop function, I had to do in this way because you actually can't use setTimeout()
inside a for
or while
loop. Im also using a similar function to Fade Out the LED.
The issue is: It works for a short period. But sometimes it literally skips a beep. Also, sometimes it just is so fast that the luminosity reduction (Fade Out) is just negligible, not even reaching "0" and starting to increase again.
Im sure that this isn't a hardware limitation (Arduino), because I've achieve what I want using Arduino Editor and C++.
At J5 website they have a lot of commands and examples only for single color LED, but nothing for RGB.
Can anyone help?