ESP32 | Sensor 10 – Traffic Light Module

01

Overview

The traffic light module is equipped with red, yellow, and green LED lights, controlled by the R, Y, and G pins to turn the corresponding lights on and off.

ESP32 | Sensor 10 - Traffic Light Module

02

Wiring

  • Supply Voltage: 3.3V / 5V
  • GND: GND, negative terminal
  • GR: Control green light
  • YE: Control yellow light
  • RE: Control red light

ESP32 | Sensor 10 - Traffic Light Module

03

Programming

ESP32 | Sensor 10 - Traffic Light Module Program Explanation:

First, initialize the three pins corresponding to the red, yellow, and green lights, setting them as digital outputs; then loop to set the levels of the three pins to high, lighting each lamp for one second.

ESP32 | Sensor 10 - Traffic Light ModuleESP32 | Sensor 10 - Traffic Light Module

04

Effect

Students who need accessories can purchase them from my Taobao store under the same name.

ESP32 | Sensor 10 - Traffic Light ModuleFollow me for more sharesWeilan Classroom

Leave a Comment