-
Notifications
You must be signed in to change notification settings - Fork 1
begin()
Arnd edited this page Jan 17, 2021
·
2 revisions
The begin() function is called by passing the Arduino pin number that the LED is attached to. The second parameter is optional, it is a boolean value that can be set to INVERT_LED (true) or NO_INVERT_LED (false). Normally a value of 0 denotes "OFF" and a value of 1023 denotes 100% "ON", but LEDs can be connected so that these values are inverted.
Each LED pin needs to have a begin() call in order to be activated.
...
...
smoothLED Board, Red; // Instantiate 2 LEDs
const uint8_t RED_PIN{11};
...
...
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(512); // set to 50% duty cycle
Serial.print(F("BOARD LED: "));
if (Red.begin(RED_PIN,INVERT_LED)) // Red pin inverted
Serial.println(F("OK"));
else
Serial.println(F("ERROR!"));
Red.set(0); // Turn pin off
...
...