ESP32 LED Blink Tutorial

 ESP32 LED Blink Tutorial

What You'll Need:

  1. ESP32 Development Board
  2. USB Cable
  3. Arduino IDE installed on your computer
  4. LED
  5. Resistor (220-1k ohm)
  6. Breadboard and jumper wires


1. Setting Up Arduino IDE for ESP32:

  • Open Arduino IDE.
  • Go to File -> Preferences.
  • In the "Additional Boards Manager URLs" field, add
  • Click OK to save.

2. Installing ESP32 Board Package:

  • Go to Tools -> Board -> Boards Manager.
  • Type "ESP32" in the search bar.
  • Install the "esp32" by Espressif Systems board package.


3. Wiring the Circuit:

  • Connect the ESP32 to the breadboard.
  • Connect the positive leg of the LED (longer leg) to GPIO pin 13 on the ESP32 through a resistor. Connect the negative leg (shorter leg) to ground (GND) on the ESP32.

4. Writing the Code:

  • Open Arduino IDE.
  • Go to File -> Examples -> Basics -> Blink.

Here is a sample code for blinking an LED connected to pin 13 on the ESP32:

// Pin connected to the LED const int ledPin = 13; void setup() { // Initialize the digital pin as an output pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); // Turn the LED on delay(1000); // Wait for 1 second digitalWrite(ledPin, LOW); // Turn the LED off delay(1000); // Wait for 1 second }

5. Uploading the Code:

  • Connect the ESP32 to your computer using the USB cable.
  • Select the board by going to Tools -> Board -> ESP32 Dev Module.
  • Choose the correct Port by going to Tools -> Port -> (Your ESP32 Port).
  • Click the Upload button (right arrow icon) to upload the code to the ESP32.

6. Testing:

  • Once uploaded, the LED connected to pin 13 on the ESP32 should start blinking on and off at one-second intervals.

Congratulations! You've successfully created a simple LED blinking program using the ESP32 and Arduino IDE. You can modify the code to change the blinking pattern, timings, or use different GPIO pins to control LEDs or other components connected to the ESP32.

Post a Comment

Previous Post Next Post