clignotante.ino
The board's sanity check: the LED blinks at 1 Hz using millis() instead of delay(), leaving the loop free for Wi-Fi or sensors. The monitor also prints free heap — handy before adding radio libraries.
Hardware required
An ESP32-C3 board (RISC-V 160 MHz, Wi-Fi + BLE 5) such as a DevKitM-1 or SuperMini, powered over USB (native on the C3). Nothing: the onboard user LED is enough (otherwise LED + 330 Ω resistor).
Wiring
Pin 8 (onboard LED on most DevKit boards); otherwise anode through 330 Ω, cathode to GND.
How it works
millis() counts elapsed milliseconds; when the gap exceeds the period the pin flips. No blocking delay: loop() can run at full speed. In the Arduino IDE (esp32 package), select « ESP32C3 Dev Module », enable « USB CDC On Boot » if needed, then Upload. GPIO9 is often the BOOT button; keep GPIO8 free at boot.
Going further
Wire two LEDs and alternate them, or vary the period with a potentiometer on an ADC pin.
clignotante.ino
// Clignotement non bloquant sur la carte esp32-c3 (millis au lieu de delay).
const int LED = 8; // LED utilisateur de la plupart des cartes
const unsigned long PERIODE = 500; // ms
bool etat = false;
unsigned long precedent = 0;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(115200);
Serial.println("Clignotement demarre");
}
void loop() {
unsigned long t = millis();
if (t - precedent >= PERIODE) {
precedent = t;
etat = !etat;
digitalWrite(LED, etat ? HIGH : LOW);
Serial.printf("LED %s — heap libre : %u\n", etat ? "ON" : "OFF", ESP.getFreeHeap());
}
}