+21622886281
ESP32 LED

Control the lighting of LED by push button with ESP32

Purpose of this tutorial:

In this tutorial we will control the lighting of an LED via a push button:

1- When the button is pressed, the LED lights up

2- When the button is released, the LED goes out.

Necessary components

  • ESP32
  • Red LED
  • pushbutton
  • des fils de connexion
  • plaque d’essai

Mounting:

We connect pin D23 of the ESP32 board to the anode (+ terminal) of the LED and the GND of the ESP32 board to the cathode (- terminal) of the LED.

We connect the first pin of the push button to the GND pin of the ESP32 board and the second pin of the push button to the D21 pin of the ESP32 board.

Micropython program

Here is the program that controls the ignition of an LED connected to pin D23 of the ESP32 board.




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top