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-C6 board (RISC-V 160 MHz, Wi-Fi 6 + BLE 5 + 802.15.4) such as a DevKitC-1, powered over USB. Nothing: the onboard user LED is enough (otherwise LED + 330 Ω resistor).
Wiring
Pin 7 (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 (recent esp32 package), select « ESP32C6 Dev Module » then Upload; for Zigbee/Thread use ESP-IDF (idf.py set-target esp32c6).
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-c6 (millis au lieu de delay).
const int LED = 7; // 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());
}
}