There is something I missed. When the board starts, the led is off. Good. When I press the button, the led start directly and is not fading. The color jump from one to another one
function setLeds() {
colFade += 0.05;
if (colFade>=1) {
colFade = 0;
colFrom = colTo;
var c = E.HSBtoRGB(Math.random(),1,1);
colTo = [ (c&0xFF)/256, ((c>>8)&0xFF)/256, ((c>>16)&0xFF)/256 ];
}
analogWrite(LED1,colFrom[0]*(1-colFade) + colTo[0]*colFade, {soft:true});
analogWrite(LED2,colFrom[1]*(1-colFade) + colTo[1]*colFade, {soft:true});
analogWrite(LED3,colFrom[2]*(1-colFade) + colTo[2]*colFade, {soft:true});
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
There is something I missed. When the board starts, the led is off. Good. When I press the button, the led start directly and is not fading. The color jump from one to another one