AbleButtons V0.4.0
Lightweight button library for Arduino.
 
Loading...
Searching...
No Matches
DoublableCallback.ino File Reference

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...
 

Detailed Description

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.

Macro Definition Documentation

◆ BUTTON_PIN

#define BUTTON_PIN   2

Connect button between this pin and ground.

Definition at line 17 of file DoublableCallback.ino.

Typedef Documentation

◆ Button

Using callback pull-up button.

Definition at line 11 of file DoublableCallback.ino.

◆ ButtonList

Using callback pull-up button list.

Definition at line 12 of file DoublableCallback.ino.

Function Documentation

◆ clickedCallback()

void clickedCallback ( Button::CALLBACK_EVENT  event,
uint8_t  id 
)

Callback function for button released.

Parameters
eventThe event that has occured.
idThe identifier of the button generating the callback (ignored in this example).

Definition at line 42 of file DoublableCallback.ino.

◆ loop()

void loop ( )

Control the ClickedBtn example.

Called repeatedly in a loop.

Definition at line 32 of file DoublableCallback.ino.

◆ setup()

void setup ( )

Setup the ClickedBtn example.

Called once to initialise everything.

Definition at line 24 of file DoublableCallback.ino.

Variable Documentation

◆ led

bool led = false

On/off state of the LED.

Definition at line 19 of file DoublableCallback.ino.