Skip to main content
The ESP32-C6 has a built-in WS2812B addressable RGB LED on GPIO 8, driven by the Adafruit NeoPixel library. The firmware uses it as a real-time status indicator — every state transition in the sketch (booting, connecting, ready, error, triggered) maps to a distinct color. You never need a serial monitor to know what the board is doing; the LED tells you at a glance.

LED Color Reference

ColorRGB ValueState
Blue(0, 0, 255)Startup — attempting to connect to Wi-Fi
Green(0, 255, 0)Wi-Fi connected (Station) or AP hotspot active — ready, BEKLE state
Yellow / Orange(255, 50, 0)Wi-Fi connection failed after 30 retries
Red(255, 0, 0)SIL command received — destruction in progress

The ledRenk Function

Both sketches share the same helper that wraps the NeoPixel API into a single three-argument call. You pass standard (R, G, B) byte values and the function handles the pixel update and refresh:
void ledRenk(uint8_t r, uint8_t g, uint8_t b) {
  led.setPixelColor(0, led.Color(r, g, b));
  led.show();
}
The function always targets pixel index 0 because the board has a single built-in LED (LED_SAYI = 1).

Brightness Setting

LED brightness is set once during setup() before the first color is applied:
led.begin();
led.setBrightness(80);  // 0–255 scale; 80 ≈ 31% brightness
ledRenk(0, 0, 255);     // Blue — connecting
A value of 80 keeps the LED visible without being distracting in a lab environment. You can raise it toward 255 for a brighter indicator or lower it for demos in dark rooms.
The NeoPixel object is initialized with NEO_GRB + NEO_KHZ800, meaning the WS2812B on the ESP32-C6 stores colors in GRB order internally. Despite this, you still call ledRenk(r, g, b) with standard RGB arguments — the library handles the byte-order swap automatically. Do not re-order your arguments to compensate.

State Transition Sequence

The LED follows the firmware lifecycle in a predictable order:
  1. Bluesetup() begins; Wi-Fi connection attempt starts.
  2. Green — Wi-Fi connected (Station) or soft-AP started (AP mode); server ready.
  3. Yellow/Orange — Wi-Fi loop exceeded 30 retries (30 × 500 ms = 15 s); setup exits.
  4. Red/tetikle endpoint called; durum set to "SIL".
  5. Green/sifirla endpoint called; durum reset to "BEKLE".
To verify your LED wiring and NeoPixel installation before uploading the full sketch, upload this minimal test:
#include <Adafruit_NeoPixel.h>

#define LED_PIN  8
#define LED_SAYI 1
Adafruit_NeoPixel led(LED_SAYI, LED_PIN, NEO_GRB + NEO_KHZ800);

void ledRenk(uint8_t r, uint8_t g, uint8_t b) {
  led.setPixelColor(0, led.Color(r, g, b));
  led.show();
}

void setup() {
  led.begin();
  ledRenk(255, 0, 0);  // RED
}

void loop() {}
If the LED lights up red, your setup is correct. If nothing happens, confirm the board selection is ESP32C6 Dev Module and the Adafruit NeoPixel library is installed.

Build docs developers (and LLMs) love