Skip to content

Releases: breadbakerman/AsyncButton

AsyncButton v1.0.0

20 Sep 18:13

Choose a tag to compare

A non-blocking Arduino library for button handling with support for multiple buttons, various press patterns, and advanced features like button mapping and customizable callbacks.

Features

  • Non-blocking operation - Uses update() calls instead of blocking delays for responsive UI
  • Multiple press patterns - Short press, long press, double press, and their combinations
  • Multiple buttons - Support for OK, CANCEL, CONFIRM buttons and custom pin configurations
  • Hardware debouncing - Built-in debounce filtering eliminates mechanical bounce issues
  • Button mapping - Map multiple physical buttons to the same logical button state
  • Callback support - Optional callbacks for long press events with rate limiting
  • Configurable timing - Customizable debounce, long press, and double-click detection windows

Installation

  1. Download the library from the releases page
  2. Extract to your Arduino libraries directory
  3. Include in your sketch: #include <AsyncButton.h>

Quick Start

#include <AsyncButton.h>

void setup() {
    Serial.begin(115200);
    AsyncButton::setup();  // Default configuration
}

void loop() {
    AsyncButton::update();  // Always call this!

    // Your code here
    if (AsyncButton::isShortPressed(BUTTON_OK)) {
        Serial.println("OK button pressed!");
    }

    if (AsyncButton::isLongPressed(BUTTON_OK)) {
        Serial.println("OK button held!");
    }
}

Examples Included

  • Basic - Simple button press detection with different patterns
  • Multiple - Handling multiple buttons simultaneously with menu interface
  • Mapping - Button mapping and callback functionality demonstration

Access via Arduino IDE: File → Examples → AsyncButton

Compatibility

  • Architectures: AVR, SAMD, SAM
  • Boards: Arduino Uno, Mega, Leonardo, M0, M4, Grand Central
  • Hardware: Works with any momentary push buttons (connect to ground)

Documentation

Full API documentation and usage examples available in the README.

Issues & Support

Found a bug or need help? Open an issue


What's Next? Check out the examples and start building responsive user interfaces!