Example on/off control from an Able 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 = AblePullupDirectButton |
| Using the direct pull-up button. More... | |
| using | ButtonList = AblePullupDirectButtonList |
| Using the direct pull-up button list. More... | |
Functions | |
| void | setup () |
| Setup the Buttonable example. More... | |
| void | loop () |
| Control the Buttonable example. More... | |
Variables | |
| Button | btn (BUTTON_PIN) |
| The button to check. | |
Example on/off control from an Able button.
This shows how Able can be used to create the same program as the built-in Button example included with the Arduino IDE.
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.
NB: This example uses direct pin reading which is not debounced. Contact bouncing can make the button's signal unstable for a few ms when pressed or released.
Definition in file Buttonable.ino.
| #define BUTTON_PIN 2 |
Connect button between this pin and ground.
Definition at line 24 of file Buttonable.ino.
| using Button = AblePullupDirectButton |
Using the direct pull-up button.
Definition at line 21 of file Buttonable.ino.
| using ButtonList = AblePullupDirectButtonList |
Using the direct pull-up button list.
Definition at line 22 of file Buttonable.ino.
| void loop | ( | ) |
Control the Buttonable example.
Called repeatedly in a loop.
Definition at line 38 of file Buttonable.ino.
| void setup | ( | ) |
Setup the Buttonable example.
Called once to initialise everything.
Definition at line 30 of file Buttonable.ino.