Development and Guides


SensorMonitor simple switch example


In this tutorial we will make use of  a library called SensorMonitor available on Github

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.

Source Code

The source code for this project is available on my GitHub Repository.

Required Components

  • Arduino
  • Push button
  • 1K Resistor
  • A breadboard might be useful if you don’t want to solder
Arduino UNO with push button
Arduino UNO with push button

Running the code

git pull
cd learn-arduino/sensor-monitor-switch
platformio init
platformio run --target run
platformio device monitor

For more information about the library used in this example see the SensorMonitor Github Repository

One thought on “SensorMonitor simple switch example

Leave a Reply

Your email address will not be published. Required fields are marked *