🛠 Faire clignoter la LED RGB sur GPIO8

ESP32-C3 · debutant · Schéma : IMG-esp32-c3-debutant-1-rgb-led-gpio8-blink.svg — Carte ESP32-C3 compacte avec LED RGB sur GPIO8 clignotant, broche signalée comme strapping

Objectives

First hello-world for the ESP32-C3 (RISC-V, single core, Wi-Fi + Bluetooth 5): control the onboard RGB LED on GPIO8, present on most compact boards (SuperMini, DevKitM). You will also learn about the peculiarity of this pin: GPIO8 is a strapping pin, which imposes wiring precautions.

Hardware

Complete code

const uint8_t LED = 8;   // LED RGB embarquee, aussi broche de strapping

void setup {
  pinMode(LED, OUTPUT);
}

void loop {
  digitalWrite(LED, HIGH); delay(150);   // double flash
  digitalWrite(LED, LOW);  delay(150);
  digitalWrite(LED, HIGH); delay(150);
  digitalWrite(LED, LOW);  delay(850);   // pause
}

Expected verification

The LED blinks according to a pattern of two short flashes followed by a one-second pause. By selecting the "ESP32C3 Dev Module" board in the Tools menu, flashing goes directly through USB-C without needing to hold a button on most boards.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials