This example uses the Sensor Monitor library to poll changes detected on the switch from an Arduino. It can be used for example to detect when a door is opened/closed, PIR motion detected, or with any other device that acts like a switch as an output.
Nothing special required besides the required components.
The source code for this project is available on my GitHub Repository.
- Push button
- 1K Resistor
- A breadboard might be useful if you don’t want to solder
Running the code
git pull https://github.com/trojanc/learn-arduino cd learn-arduino/sensor-monitor-switch platformio init platformio run --target run platformio device monitor