Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
okhsunrog committed Jul 17, 2023
1 parent 2dc7e31 commit 58ac3c9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ 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();
led_state_off = !led_state_off;
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
```

0 comments on commit 58ac3c9

Please sign in to comment.