ESP32 - Button Toggle Relay
This tutorial instructs you how to use ESP32 to toggle the a relay's state between ON and OFF when a button is pressed. More specifically:
- If the button is pressed, turn on the relay
- If the button is pressed again, turn off the relay
- The above process is repeated over and over again
The ESP32 codes contains code for a button toggles a relay without and with debouncing
We can extend this tutorial to use button to toggle the state of a solenoid, fan, light bulb, or actuator... by connnecting them to the relay.
Hardware Used In This Tutorial
|1||×||ESP-WROOM-32 Dev Module|
|1||×||Micro USB Cable|
|1||×||Warning Light Bright Waterproof|
|1||×||12V Power Adapter|
This image is created using Fritzing. Click to enlarge image
Making video is a time-consuming work. If the video tutorial is necessary for your learning, please let us know by subscribing to our YouTube channel , If the demand for video is high, we will make the video tutorial.