// Example how to use the RGB led on a ESP32-C6
// This is the preferred way in 2025.
//
// The digitalWrite() function can switch
// to Neopixel mode and use the RGB led,
// but I think that code is confusing.
// Using "rgbLedWrite()" is straightforward.
void setup()
{
Serial.begin(115200);
Serial.print("The RGB led is at pin: ");
Serial.println(RGB_BUILTIN);
}
void loop()
{
rgbLedWrite(RGB_BUILTIN, 255,0,0);
delay(500);
rgbLedWrite(RGB_BUILTIN, 0,255,0);
delay(500);
rgbLedWrite(RGB_BUILTIN, 0,0,255);
delay(500);
}Loading
esp32-c6-devkitc-1
esp32-c6-devkitc-1
The onboard RGB led is connected to pin 39,
but also to pin 8 (in Wokwi).