-
Notifications
You must be signed in to change notification settings - Fork 1
set()
The set() function is called to set the PWM value of a pin. The PWM value is an integer between 0 ("OFF") and 1023 (100% "ON"). If the second parameter is omitted the pin is set to the PWM value immediately, if the second parameter is specified then the LED will fade/brighten from the current setting to the new setting at the speed specified. The speed is given in milliseconds, e.g. a speed of 5000 would change the LED from the current value to that in the {value} parameter over a course of 5 seconds. The minimum speed for a full ON to OFF transition (1023 steps) is approximately 500ms and any speed below that is changed to the fasest rage the library can change at.
The set() function returns immediately and any fading/brightening happens in the background, letting the program continue processing.
...
...
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(1023,10000); // Slowly brighten the LED over 10 seconds
...
...