If you plug in your new microcontroller, upload the code, and nothing happens, your first instinct is to assume the board is dead. Don’t panic. Nine times out of ten, it’s just a tiny LED plugged in backward. We see this simple mistake every single week at our workshop. |
Blinking an LED is the classic “Hello World” of hardware. It is the quickest—without burning out your components. |

The goal: A simple blinking red LED controlled by the ESP32
What You Actually Need
To complete this lesson, you will need the following electronic components:
1x ESP32 Development Board (NodeMCU-32S style)
* 1x Red LED (5mm)
* 1× 220-ohm Resistor (Red-Red-Brown color bands)
* 1x Breadboard
* Jumper Wires (1x Red wire, 1x Black wire, 1x Green wire)
Note: All of these components are included in the premium TNNJoy ESP32 Basic Starter Kit*.*
The Wiring Setup: Avoid the Pinout Trap
Here is a classic trap that trips up beginners and experienced makers alike. |
On the ESP32 DevKit V1 board, there is a pin labeled |

The complete wiring layout. Make sure you use pin 2 on the right.
Follow these steps to wire it:
Mount the ESP32 onto the center of your breadboard.
2. Orient the LED. Look at the legs. The longer, bent leg is the Anode (+). The shorter, straight leg is the Cathode (-).
3. Connect the Cathode (-) to the 220-ohm resistor.
4. Run a Black wire from the other side of the resistor to the GND pin (6th pin from the bottom on the left).
5. Run a Red wire from the Anode (+) to Pin *
2** (5th pin from the bottom on the right).

Wiring connections on the ESP32 board, showing both the Ground (GND) and Pin 2 (GPIO 2) setup.

Detailed connection of the LED legs (Anode to Red wire, Cathode to Green wire).

Connecting the control wire to Pin 2 (GPIO 2) on the right side of the ESP32.
Why do we need the resistor?
If you connect the LED directly to the ESP32 pin without a resistor, the 3.3V output will draw too much current. The LED will flash brightly once, burn out, and potentially damage your ESP32 pin. The 220-ohm resistor limits the current to a safe level. |

The 220-ohm resistor (Red-Red-Brown) used to limit current and protect the LED.
Writing the Arduino Code
Open your Arduino IDE, paste this code, and upload it.

// ----------------------------------------------------
// PROJECT: ESP32 DIY Starter Kit
// LESSON 1: Blinking an LED
// DESIGNED BY: TNNJoy (blog.tnnjoy.com)
// ----------------------------------------------------
const int ledPin = 2; // LED connected to GPIO Pin 2
void setup() {
// Set the LED pin as an OUTPUT so we can send electricity to it
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH); // Turn the LED ON (Send 3.3V)
delay(500); // Wait for 0.5 seconds
digitalWrite(ledPin, LOW); // Turn the LED OFF (Send 0V)
delay(500); // Wait for 0.5 seconds
}
## Bring Your Code to Life in the Real World!
Simulation is fun, but nothing beats the feeling of holding the components, plugging in the wires, and watching a physical LED light up on your desk!
If you're ready to start your electronics journey, grab your complete kit today. It includes high-quality components, step-by-step visual guides, and free coding templates to help you build dozens of amazing projects.
👉 [Get your TNNJoy ESP32 Basic Starter Kit on Etsy here!](https://tnnjoy.etsy.com/listing/4419365179)