AbleButtons V0.2.0
Lightweight button library for Arduino.
 
Loading...
Searching...
No Matches
ButtonableCallback.ino File Reference

Example on/off button via callback functions. 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 = AblePullupCallbackButton
 Using callback pull-up button. More...
 
using ButtonList = AblePullupCallbackButtonList
 Using callback pull-up button list. More...
 

Functions

void buttonableCallback (Button::CALLBACK_EVENT event, uint8_t id)
 Callback function for button events. More...
 
void setup ()
 Setup the ButtonableCallback example. More...
 
void loop ()
 Control the ButtonableCallback example. More...
 

Variables

Button btn (BUTTON_PIN, buttonableCallback)
 The button to check.
 

Detailed Description

Example on/off button via callback functions.

Similar to Buttonable example, but uses on-pressed and on-released callback functions to control the built-in LED.

Definition in file ButtonableCallback.ino.

Macro Definition Documentation

◆ BUTTON_PIN

#define BUTTON_PIN   2

Connect button between this pin and ground.

Definition at line 17 of file ButtonableCallback.ino.

Typedef Documentation

◆ Button

Using callback pull-up button.

Definition at line 11 of file ButtonableCallback.ino.

◆ ButtonList

Using callback pull-up button list.

Definition at line 12 of file ButtonableCallback.ino.

Function Documentation

◆ buttonableCallback()

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

Callback function for button events.

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

Definition at line 42 of file ButtonableCallback.ino.

◆ loop()

void loop ( )

Control the ButtonableCallback example.

Called repeatedly in a loop.

Definition at line 31 of file ButtonableCallback.ino.

◆ setup()

void setup ( )

Setup the ButtonableCallback example.

Called once to initialise everything.

Definition at line 23 of file ButtonableCallback.ino.