> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kode.diy/llms.txt
> Use this file to discover all available pages before exploring further.

# Addresable LED

> Learn how the addresable LED works and give light to your projects.

# Features

The Kode Dot integrates an **addresable LED** on the top left of the pad, that you can light up with the **color and brightness you want.**

It is not a normal RGB LED, but an **addresable RGB LED WS2812B.** This means that inside the LED there is a **small integrated circuit** that can independently handle the color of the RGB LEDs and the brightness of each one.

| Feature | Description      |
| ------- | ---------------- |
| Driver  | WS2812B - 1-Wire |
| Size    | 2mm x 2mm        |
| Color   | RGB              |

## Connection diagram

The addresable LED works through a single pin connected to the ESP32-S3.

| WS2812B | ESP32-S3 |
| ------- | -------- |
| Data    | GPIO4    |

<Note> 1-Wire is a communication protocol that allows data communication through a single pin.</Note>

## Recommended libraries

### Arduino

* [Adafruit\_NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel)
* [FastLED](https://github.com/FastLED/FastLED)

### ESP-IDF

* [led\_indicator](https://components.espressif.com/components/espressif/led_indicator)
* [led\_strip](https://components.espressif.com/components/espressif/led_strip)

## Example code

This code lights up the addresable LED by making a color cycle: first red, then green, and finally blue.

```cpp rgb_cycle.ino lines icon="microchip" theme={null}
/**
 * Controls a single NeoPixel connected to GPIO 4, lighting it in red, green, and blue.
 * Each color stays on for half a second, turning off between changes.
 * Uses the Adafruit_NeoPixel library to control RGB LEDs.
 */
/* ───────── KODE | docs.kode.diy ───────── */

#include <Adafruit_NeoPixel.h> /* Library to control NeoPixel strips and LEDs */

#define NEOPIXEL_PIN   4                  /* GPIO pin where the NeoPixel is connected */
#define NUMPIXELS      1                  /* Number of connected NeoPixels */
#define PIXEL_FORMAT   (NEO_GRB + NEO_KHZ800) /* Color format and data speed */

Adafruit_NeoPixel *pixels;                /* Pointer to the NeoPixel object */

#define DELAYVAL       500                /* Delay time between changes (ms) */

void setup() {
  Serial.begin(115200);                   /* Start serial communication for debugging */

  /* Create the NeoPixel object with the defined parameters */
  pixels = new Adafruit_NeoPixel(NUMPIXELS, NEOPIXEL_PIN, PIXEL_FORMAT);

  pixels->begin();                        /* Initialize the NeoPixel */
  pixels->clear();                        /* Ensure the LED starts off */
  pixels->show();                         /* Apply the change */
}

void loop() {
  /* Turn on red */
  pixels->setPixelColor(0, pixels->Color(150, 0, 0));
  pixels->show();
  delay(DELAYVAL);

  /* Turn off */
  pixels->setPixelColor(0, pixels->Color(0, 0, 0));
  pixels->show();
  delay(DELAYVAL);

  /* Turn on green */
  pixels->setPixelColor(0, pixels->Color(0, 150, 0));
  pixels->show();
  delay(DELAYVAL);

  /* Turn off */
  pixels->setPixelColor(0, pixels->Color(0, 0, 0));
  pixels->show();
  delay(DELAYVAL);

  /* Turn on blue */
  pixels->setPixelColor(0, pixels->Color(0, 0, 150));
  pixels->show();
  delay(DELAYVAL);

  /* Turn off */
  pixels->setPixelColor(0, pixels->Color(0, 0, 0));
  pixels->show();
  delay(DELAYVAL);
}
```

## Download examples

You can test the example codes using the Arduino IDE or the ESP-IDF IDE or download the codes in our drive:

[Addresable LED examples](https://drive.google.com/drive/folders/1f7pmw24Q7ikkvg6vVaRGUN63GGYj1NbC)
