# ESP32 Neopixel Driver High-performance low-level driver for WS2812B LEDs. # Example Application ```cpp #include <sys/fcntl.h> #include <sys/unistd.h> #include <freertos/FreeRTOS.h> #include <freertos/task.h> #include "esp_log.h" #include "driver/gpio.h" #include "neopixel.h" #include "helpers.h" #define PIXEL_COUNT 44 #define NEOPIXEL_PIN GPIO_NUM_27 void app_main(void) { tNeopixelContext neopixel; uint32_t iteration; uint32_t refreshRate; uint32_t taskDelay; neopixel = neopixel_Init(PIXEL_COUNT, NEOPIXEL_PIN); refreshRate = neopixel_GetRefreshRate(neopixel); ESP_LOGI(__func__, "Refresh rate: %" PRIu32, refreshRate); iteration = 0; taskDelay = MAX(1, pdMS_TO_TICKS(1000UL / refreshRate)); for(;;) { tNeopixel pixel[] = { { (iteration) % PIXEL_COUNT, NP_RGB(0, 0, 0) }, { (iteration+5) % PIXEL_COUNT, NP_RGB(0, 0, 1) }, }; neopixel_SetPixel(neopixel, pixel, ARRAY_SIZE(pixel)); ++iteration; vTaskDelay(taskDelay); } neopixel_Deinit(neopixel); } ```
idf.py add-dependency "zorxx/neopixel^1.0.0"