FadeLed
A simple Arduino library to fade leds on hardware PWM
|
Example how to use FadeLed to set the brightness of a LED with a button. More...
Functions | |
void | setup () |
void | loop () |
Variables | |
FadeLed | led (5) |
bool | wasFadingUp = false |
const byte | ButtonPin = 4 |
Bounce | button |
Example how to use FadeLed to set the brightness of a LED with a button.
Septillion (https://github.com/sseptillion)
This example requires the Bounce2 library (https://github.com/thomasfredericks/Bounce2)
This shows how you can make a LED which you can fade up and down to set the desired brightness. The brightness will keep fading up and down as long as the button is pressed and will stop at the current brightness once the button is released. Fading will start in opposite direction is the button is pressed again.
Pin 5 is used for the LED
Pin 4 is used for a button. Connect a push button between this pin and GND.