Skip to content

setNow()

Arnd edited this page Jan 31, 2021 · 1 revision

setNow( {value} [, {speed}] [, {delay}] );

The normal The set() command will queue subsequent calls if there is still an active fade; this function causes any queued commands to be discarded and the current command to be interrupted and replaced with the values specified.


Example:

...    
...    
smoothLED Board;
...    
...    
Serial.print(F("BOARD LED: "));
if (Board.begin(LED_BUILTIN)) // Start the "Board" instance on pin 13
  Serial.println(F("OK"));
else
  Serial.println(F("ERROR!"));
Board.set(0); // set to OFF
Board.set(255,10000); // Slowly brighten the LED over 10 seconds
delay(2000);
Boad.setnow(0); // interrupt the brighten command and immediately turn off LED
...    
...