Last active
December 4, 2017 19:52
-
-
Save Mr-NVR/742fbaceb5c28d7ad73844e10096f175 to your computer and use it in GitHub Desktop.
FastLED test for ESP32 APA102 based on https://github.com/FastLED/FastLED/wiki/Basic-usage#moving-an-led
This file contains 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 "FastLED.h" | |
#define DATA_PIN 16 | |
#define CLK_PIN 17 | |
#define LED_TYPE APA102 | |
#define COLOR_ORDER BGR // RGB, BGR | |
#define NUM_LEDS 64 | |
#define BRIGHTNESS 30 | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
Serial.begin(115200); | |
FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER, DATA_RATE_MHZ(1)>(leds, NUM_LEDS); | |
FastLED.setBrightness(BRIGHTNESS); | |
fill_solid(leds, NUM_LEDS, CRGB::Blue); | |
FastLED.show(); | |
} | |
void loop() { | |
for(int dot = 0; dot < NUM_LEDS; dot++) { | |
Serial.print("x"); // Print an "x" so we know it's running... | |
leds[dot] = CRGB::Blue; | |
FastLED.show(); | |
// clear this led for the next time around the loop | |
leds[dot] = CRGB::Black; | |
delay(30); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment