Button
The simplest button debounce utility for Arduino
Install / Use
/learn @e-tinkers/ButtonREADME
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
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
