ESP32 2-Color LED Module
This project demonstrates how to control a 2-color LED module using an ESP32 microcontroller. The 2-color LED allows for switching between two colors, showcasing basic LED control and timing operations.
Components Needed
- ESP32 Microcontroller
- 2-Color LED Module
- Jumper Wires
- Breadboard
Circuit Setup
Connecting the 2-Color LED to ESP32:
Connect the cathode of the first color LED to GPIO pin 12 on the ESP32.
Connect the cathode of the second color LED to GPIO pin 14 on the ESP32.
Ensure appropriate current-limiting resistors are used if necessary.
Instructions
Setup:
Initialize the GPIO pins connected to the LED cathodes as outputs using pinMode().
Operation:
In the loop() function:
Alternate between turning on the first color and turning off the second color using digitalWrite() with appropriate delay intervals.
Switch to turning off the first color and turning on the second color with another set of delay intervals.
Repeat this cycle to create a blinking effect with the two different colors.
Considerations:
Current Limiting: Ensure the current supplied to each LED color is within safe operating limits.
Timing: Adjust the delay periods in delay() function calls to achieve desired blinking rates.
Color Selection: Use LEDs compatible with the ESP32's GPIO voltage levels and current requirements.