New button template
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

This commit is contained in:
Eric Ratliff
2026-02-22 17:06:02 -06:00
parent 578b5f02c0
commit e12608370a
9 changed files with 898 additions and 5 deletions

View File

@@ -0,0 +1,35 @@
/*
* {{PROJECT_NAME}}.ino -- Pushbutton input with edge detection
*
* Detects button presses (rising edge only) and prints to Serial:
*
* Button pressed! (count: 1)
* Button pressed! (count: 2)
*
* All logic lives in lib/app/{{PROJECT_NAME}}_app.h which depends
* on the HAL and Button interfaces, making it fully testable
* on the host without hardware.
*
* Wiring (active-low, no external resistor needed):
* Pin 2 -> one leg of the button
* GND -> other leg of the button
* (uses INPUT_PULLUP internally)
*
* Serial: 115200 baud
*/
#include <hal_arduino.h>
#include <{{PROJECT_NAME}}_app.h>
#include <button_digital.h>
static ArduinoHal hw;
static ButtonDigital btn(&hw, 2); // pin 2, active-low (default)
static ButtonApp app(&hw, &btn);
void setup() {
app.begin();
}
void loop() {
app.update();
}