This circuit is designed around the ESP32 microcontroller, which is a versatile and powerful chip with WiFi and Bluetooth capabilities. In this particular application, the ESP32 is used to control an LED. The LED blinks on and off every second, demonstrating the basic digital output functionality of the ESP32. The LED is connected to the ESP32 through a current-limiting resistor to protect the LED from excessive current.
/* ESP32 LED Blinker
* This sketch controls an LED connected to GPIO 2 of the ESP32.
* The LED blinks on and off every second. This circuit demonstrates
* basic digital output functionality of the ESP32 by using a digital
* pin to provide a voltage to an LED through a current-limiting resistor.
*/
// Define the LED pin
const int ledPin = 2; // GPIO 2 is often labeled as D2 or IO2 on ESP32 boards
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin ledPin as an output.
pinMode(ledPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
setup()
function initializes the pin, and the loop()
function toggles the LED state between HIGH and LOW every second, creating a blinking effect.