Example on/off control from a button. 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 = AblePullupButton |
Using basic pull-up button. More... | |
using | ButtonList = AblePullupButtonList |
Using basic pull-up button list. More... | |
Functions | |
void | setup () |
Setup the Buttonable2 example. More... | |
void | loop () |
Control the Buttonable2 example. More... | |
Variables | |
Button | btn (BUTTON_PIN) |
The button to check. | |
Example on/off control from a button.
Similar to the Buttonable example, except this example uses a debounced pin.
NB: All that's changes is the using Button
and using ButtonList
lines at the beginning of the program to select debounced reading capability.
The built-in LED lights when a button connected between pin 2 and ground is pressed. It uses the internal pull-up resistor within an Arduino for the simplest button connection.
Definition in file Buttonable2.ino.
#define BUTTON_PIN 2 |
Connect button between this pin and ground.
Definition at line 20 of file Buttonable2.ino.
using Button = AblePullupButton |
Using basic pull-up button.
Definition at line 17 of file Buttonable2.ino.
using ButtonList = AblePullupButtonList |
Using basic pull-up button list.
Definition at line 18 of file Buttonable2.ino.
void loop | ( | ) |
Control the Buttonable2 example.
Called repeatedly in a loop.
Definition at line 34 of file Buttonable2.ino.
void setup | ( | ) |
Setup the Buttonable2 example.
Called once to initialise everything.
Definition at line 26 of file Buttonable2.ino.