Created
March 18, 2020 17:22
-
-
Save drewandre/6f2db54dfd76268ada42f8d009aa3e24 to your computer and use it in GitHub Desktop.
FastLED on ESP32-LyraT 4.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Arduino.h" | |
#include "FastLED.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <math.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" | |
#include "nvs.h" | |
#include "nvs_flash.h" | |
#include "esp_system.h" | |
#include "esp_log.h" | |
#define NUM_LEDS 100 | |
#define DATA_PIN 12 | |
CRGB leds[NUM_LEDS]; | |
#define LED_TAG "FASTLED" | |
void testCylonSpeed() | |
{ | |
fadeToBlackBy(leds, NUM_LEDS, 17); | |
static int i = 0; | |
if (i >= NUM_LEDS) | |
{ | |
i = 0; | |
} | |
else | |
{ | |
i++; | |
} | |
leds[i] = CHSV(200, 255, 255); | |
} | |
#ifdef __cplusplus | |
extern "C" | |
{ | |
#endif | |
void app_main() | |
{ | |
initArduino(); | |
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); | |
fill_solid(leds, NUM_LEDS, CRGB::Black); | |
FastLED.show(); | |
int i = 0; | |
while (1) | |
{ | |
testCylonSpeed(); | |
FastLED.show(); | |
} | |
} | |
#ifdef __cplusplus | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment