Blinking an LED With ESP32

118,746

18

9

Introduction: Blinking an LED With ESP32

The ESP32 is an advanced IoT microcontroller board possessing WiFi and Bluetooth Low Energy capabilities, as well as limited compatibility with the Arduino Core. This is the first module in a series of tutorials regarding the use of the ESP32 Development Board, from it's equivalent Arduino projects to advanced IoT projects.

The 'Blinking an LED' project uses the ESP32 Development Board will be used to blink an LED at a specific timed interval, infinitely. It is the essential fundamental tutorial for any microcontroller board, as it is the hardware equivalent of the classic "Hello World" tutorial!!!

Step 1: Tools and Materials

Step 2: Circuitry

  • Connect the negative pin (cathode) of the LED, indicated as the flat edge of the LED to ground, shown as the blue wire.
  • Connect the positive pin (anode) of the LED, indicated as the rounded edge of the LED to a 100Ω resistor.
  • Connect the free end of the resistor to pin D5 on the ESP32, shown as the red wire.

Step 3: Coding

/***
 * LED Blinking
 * Code Written by TechMartian
 */
const int ledPin = 5;
void setup() {
  // setup pin 5 as a digital output pin
  pinMode (ledPin, OUTPUT);
}
void loop() {
  digitalWrite (ledPin, HIGH);	// turn on the LED
  delay(500);	// wait for half a second or 500 milliseconds
  digitalWrite (ledPin, LOW);	// turn off the LED
  delay(500);	// wait for half a second or 500 milliseconds
}
Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

7 People Made This Project!

Recommendations

  • Tinkercad to Fusion 360 Challenge

    Tinkercad to Fusion 360 Challenge
  • Remote Control Contest

    Remote Control Contest
  • Stone Concrete Cement Contest

    Stone Concrete Cement Contest

9 Comments

0
john henry
john henry

1 year ago

thanks this worked great once i figured out what esp32 board i needed to select in arduino board manager.

0
hekoman
hekoman

Reply 1 year ago

how did you find out which one to select?

0
john henry
john henry

Reply 1 year ago

i kept trying the ones with 32 in it until it worked. lol
the seller wasn't clear and listed 5 of them making it very confusing.

0
bbogdanmircea
bbogdanmircea

2 years ago

Hello, do you have any idea why when I want to do the same blinking by using the value of millis() % 500, and then toggle the value of the pin, then the blinking is not constant?
I don't think the delay is a nice example as this stops the processor

0
abhijeet_dp
abhijeet_dp

3 years ago

Nice tutorial. Good place to start for an absolute beginner like me.

0
steveinjava
steveinjava

4 years ago

Using the Arduino IDE, what device do you call this module...there are several ESP32 devices listed and none seem to connect for me...Txs in advance

0
SeemabF
SeemabF

4 years ago

Hi which software you have used for ESP-module test_bed drawing

0
SebastienH12
SebastienH12

4 years ago

Wrong resistor value, preferred output is 6mA only.