Example of toggling an LED using callback functions instead of a clicker. More...
#include <AbleButtons.h>
Go to the source code of this file.
Macros | |
#define | BUTTON_PIN 2 |
Connect button between this pin and ground. More... | |
Typedefs | |
using | Button = AblePullupCallbackDoubleClickerButton |
Using callback pull-up button. More... | |
using | ButtonList = AblePullupCallbackDoubleClickerButtonList |
Using callback pull-up button list. More... | |
Functions | |
void | clickedCallback (Button::CALLBACK_EVENT event, uint8_t id) |
Callback function for button released. More... | |
void | setup () |
Setup the ClickedBtn example. More... | |
void | loop () |
Control the ClickedBtn example. More... | |
Variables | |
Button | btn (BUTTON_PIN, clickedCallback) |
The button to check. | |
bool | led = false |
On/off state of the LED. More... | |
Example of toggling an LED using callback functions instead of a clicker.
When the button is single-clicked, the LED will be illuminated. Double-click to turn the LED off.
Definition in file DoublableCallback.ino.
#define BUTTON_PIN 2 |
Connect button between this pin and ground.
Definition at line 17 of file DoublableCallback.ino.
Using callback pull-up button.
Definition at line 11 of file DoublableCallback.ino.
Using callback pull-up button list.
Definition at line 12 of file DoublableCallback.ino.
void clickedCallback | ( | Button::CALLBACK_EVENT | event, |
uint8_t | id | ||
) |
Callback function for button released.
event | The event that has occured. |
id | The identifier of the button generating the callback (ignored in this example). |
Definition at line 42 of file DoublableCallback.ino.
void loop | ( | ) |
Control the ClickedBtn example.
Called repeatedly in a loop.
Definition at line 32 of file DoublableCallback.ino.
void setup | ( | ) |
Setup the ClickedBtn example.
Called once to initialise everything.
Definition at line 24 of file DoublableCallback.ino.
bool led = false |
On/off state of the LED.
Definition at line 19 of file DoublableCallback.ino.