# ESP32-led-strip
Multi-protocol LED strip controller for ESP32, supporting both RGB and RGBW LED types across RMT and SPI interfaces.
## Supported LED Strip Types
- WS2812 / WS2812B (RMT)
- SK6812 (RGB or RGBW, RMT)
- APA104 (RMT)
- APA102 / SK9822 (SPI)
- LPD8806 / WS2801 (SPI)
## What It Does
This component abstracts away low-level LED driving using the ESP32's RMT or SPI peripherals. Based on your selection in `menuconfig`, it automatically chooses the right backend and handles LED updates.
## Configuration via menuconfig
Run:
```bash
idf.py menuconfig
```
Then go to:
```
ESP32 LED Strip Configuration --->
```
Options include:
- Strip type (choice: WS2812, SK6812, APA102, etc.)
- GPIO pin (RMT or SPI MOSI)
- SPI Clock pin (if SPI selected)
- Number of LEDs
## Example Usage
```c
#include <stdio.h>
#include "esp32_led_strip.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(void) {
if (!led_strip_init()) {
printf("LED strip init failed!\n");
return;
}
while (1) {
for (int i = 0; i < CONFIG_LED_STRIP_LENGTH; i++) {
led_strip_clear();
led_strip_set_pixel(i, 255, 0, 0, 0); // Red
led_strip_show();
vTaskDelay(pdMS_TO_TICKS(50));
}
}
}
```
## Building and Flashing
```bash
idf.py build
idf.py flash
idf.py monitor
```
## Notes
- Uses RMT or SPI depending on strip type
- Supports RGB and RGBW color formats
- Designed to be modular, lightweight and ESP-IDF native
- Compatible with all ESP32-family chips (ESP32, C2, C3, C5, C6, S2, S3)
- No dynamic allocation or external dependencies
---
**StudioPieters®** — Innovation and Learning Labs
https://www.studiopieters.nl | GitHub: https://github.com/AchimPieters
idf.py add-dependency "achimpieters/esp32-led-strip^1.1.1"