-
-
Save anonymous/cf4efc6b1c0784afe329aeda563e33ff to your computer and use it in GitHub Desktop.
FastLED - Animation test - Moving blue pixels over white
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" | |
// How many leds in your strip? | |
#define NUM_LEDS 39 | |
// For led chips like Neopixels, which have a data line, ground, and power, you just | |
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, | |
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN | |
#define DATA_PIN 8 | |
#define CLOCK_PIN 7 | |
// Define the array of leds | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
Serial.begin(57600); | |
Serial.println("resetting"); | |
//LEDS.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS); | |
FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); | |
LEDS.setBrightness(40); | |
} | |
//void fadeall() { for(int i = 0; i < NUM_LEDS; i++); } | |
void loop() { | |
static uint8_t hue = 0; | |
Serial.print(hue); | |
// First slide the led in one direction | |
for(int i = 0; i < NUM_LEDS; i++) { | |
// Set the i'th led to blue | |
leds[i] = CHSV(255, 255, 255); | |
// Show the leds | |
FastLED.show(); | |
// now that we've shown the leds, reset the i'th led to white | |
leds[i] %= 32; | |
FastLED.show(); | |
leds[i] = CHSV(255, 0, 50); | |
// fadeall(); | |
// Wait a little bit before we loop around and do it again | |
delay(100); | |
} | |
Serial.print("x"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment