SkillAgentSearch skills...

Button

The simplest button debounce utility for Arduino

Install / Use

/learn @e-tinkers/Button
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

The simplest button debounce utility for Arduino

This library is probably the simplest button debounce ulitity for Arduino. The code is based on Jack Ganssle's debounce function that he described in his part 2 of "A Guide to Debouncing" article.

Example

#include "button.h"

Button btn1;
Button btn2;

void setup() {
  btn1.begin(2);
  btn2.begin(3);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // press button 1 to turn on the LED
  if (btn1.debounce()) {
    digitalWrite(LED_BUILTIN, HIGH);
  }
  // press button 2 to turn off the LED
  if (btn2.debounce()) {
    digitalWrite(LED_BUILTIN, LOW);
  }
}

Refer to my blog post on the explanation on how the debounce function actually work.

Related Skills

View on GitHub
GitHub Stars21
CategoryDevelopment
Updated3mo ago
Forks7

Languages

C++

Security Score

87/100

Audited on Dec 4, 2025

No findings