🛠 Faire clignoter une LED avec l'ESP8266-ESP-12E

ESP8266 (ESP-12E module) · debutant · Schéma : IMG-esp8266-esp-12e-debutant-1-esp8266-blink-led.svg — Carte ESP8266-ESP-12E alimentée en 3,3 V, LED avec résistance sur GPIO2, broches CH_PD et VCC câblées.

Objectives

Discover the ESP8266-ESP-12E board by making an LED blink. This first setup helps you understand the 3.3 V power supply requirement only (never 5 V on this board!), the role of the CH_PD pin (or the module's VCC) which must be connected to 3.3 V for the module to start, and the principle of the GPIO2 pin: it must remain high at startup, which is the case with an LED and its resistor connected to ground. The module has only one Xtensa core: the entire program runs sequentially.

Materials

Complete code

// Clignotement LED sur GPIO2 (broche D4 sur cartes NodeMCU)
const uint8_t LED_PIN = 2;

void setup {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);   // LED éteinte au repos
}

void loop {
  digitalWrite(LED_PIN, HIGH);  // LED allumée
  delay(500);
  digitalWrite(LED_PIN, LOW);   // LED éteinte
  delay(500);
}

Expected verification

The LED blinks once per second (500 ms on, 500 ms off). On most ESP-12E modules, the onboard LED is indeed on GPIO2: the setup therefore works even without an external LED. If the module does not start at all (silent serial port, no boot message), first check that CH_PD is properly connected to 3.3 V.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials