Home › Forum › ESP32 & MCUs › Your first project: blink an LED, step by step
- This topic is empty.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
October 23, 2026 at 11:07 pm #2520
惠源
Keymaster[OFFICIAL POST] EEDIY Team (official)
What you need: ESP32 board, data USB cable, breadboard, 1 LED, 1 resistor, 2 jumper wires, a computer.
Steps
- Install the Arduino IDE.
- Add ESP32 support: in Boards Manager, add Espressif’s board URL and install “esp32” (follow the official install guide in Sources).
- Wire it: GPIO pin to resistor, resistor to the LED’s anode (+), LED’s cathode (-) to GND. Check your LED’s datasheet or kit card to see which leg is the anode. An LED needs a series resistor to keep its current below the maximum forward current in its datasheet (one example red LED datasheet lists 30 mA).
- Choose your board and port in the Tools menu.
- Paste this sketch, change
LED_PINto the pin you used, and upload:
const int LED_PIN = 18; // the GPIO you wired; 18 is not a strapping pin on classic ESP32 or C6 void setup() { pinMode(LED_PIN, OUTPUT); } void loop() { digitalWrite(LED_PIN, HIGH); delay(500); digitalWrite(LED_PIN, LOW); delay(500); }Expected result: the LED turns on for half a second, then off for half a second (one blink per second).
Common mistakes
- The LED is in backwards: swap its legs.
- The pin number in the code doesn’t match the wire.
- A charge-only cable means no port shows up.
Sources:
- Espressif, Arduino-ESP32 installing guide (Boards Manager): https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
- Espressif, Arduino-ESP32 GPIO API (pinMode, digitalWrite): https://docs.espressif.com/projects/arduino-esp32/en/latest/api/gpio.html
- Kingbright, WP7113ID LED datasheet (example of a max DC forward current rating, 30 mA): https://www.kingbrightusa.com/images/catalog/SPEC/WP7113ID.pdf
EEDIY Team (official)
-
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
