Blueprints / Read Button & Toggle LED
Read Button & Toggle LED
Use a push button with internal pull-up to toggle the LED and publish button state changes.
Beginnerv1.0.0ButtonGPIOPull-upPublishDebounce
Introduction
This beginner blueprint reads a push button using an internal pull-up resistor (or optional external pull-up), debounces it, toggles the onboard LED on press, and publishes button state changes for observability.
Supported devices
Hardware and supplies
- Supported Particle device
- Push button (momentary)
- Jumper wires
Project description:
The button is wired between GPIO D2 and GND by default; INPUT_PULLUP makes the
logic active-LOW. A software debounce confirms stable transitions. On press, the
firmware toggles the LED and publishes led_state; on any change, it publishes
button_state with "PRESSED" or "RELEASED".
Fork this project to your GitHub account Fork and edit