update example
This commit is contained in:
parent
2dc7e31195
commit
58ac3c9ae5
1 changed files with 6 additions and 6 deletions
12
README.md
12
README.md
|
|
@ -20,19 +20,20 @@ Minimal working example (blink):
|
|||
|
||||
static const char *TAG = "example";
|
||||
static uint8_t led_state_off = 0;
|
||||
CRGB* ws2812_buffer;
|
||||
|
||||
|
||||
void blink_led(void) {
|
||||
for(int i = 0 ; i < LED_NUM ; i++) {
|
||||
if (led_state_off) ws28xx_pixels[i] = (CRGB){.r=0,.g=0,.b=0};
|
||||
else ws28xx_pixels[i] = (CRGB){.r=50,.g=0,.b=0};
|
||||
for(int i = 0; i < LED_NUM; i++) {
|
||||
if (led_state_off) ws2812_buffer[i] = (CRGB){.r=0, .g=0, .b=0};
|
||||
else ws2812_buffer[i] = (CRGB){.r=50, .g=0, .b=0};
|
||||
}
|
||||
ws28xx_update();
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(ws28xx_update());
|
||||
}
|
||||
|
||||
|
||||
void app_main(void) {
|
||||
ws28xx_init(LED_GPIO, WS2812B, LED_NUM);
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(ws28xx_init(LED_GPIO, WS2812B, LED_NUM, &ws2812_buffer));
|
||||
while (1) {
|
||||
ESP_LOGI(TAG, "Turning the LED strip %s!", led_state_off == true ? "ON" : "OFF");
|
||||
blink_led();
|
||||
|
|
@ -40,5 +41,4 @@ void app_main(void) {
|
|||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue