Skip to content

Instantly share code, notes, and snippets.

@Mihiripenna
Created January 31, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mihiripenna/091cb870831970a54b6f to your computer and use it in GitHub Desktop.
Save Mihiripenna/091cb870831970a54b6f to your computer and use it in GitHub Desktop.
#include "FastLED.h"
#define DATA_PIN
#define CLOCK_PIN
#define NUM_STRIPS 3
#define NUM_LEDS 50
CRGB leds[NUM_STRIPS][NUM_LEDS];
void setup() {
FastLED.addLeds<WS2801,3,2>(leds[0], NUM_LEDS);
FastLED.addLeds<WS2801,5,4>(leds[1], NUM_LEDS);
FastLED.addLeds<WS2801,6,7>(leds[2], NUM_LEDS);
}
void loop() {
// This outer loop will go over each strip, one at a time
// This inner loop will go over each led in the current strip, one at a time
for(int i = 0; i < NUM_LEDS; i++) {
for(int x = 0; x < NUM_STRIPS; x++) {
leds[x][i] = CRGB::White;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::Black;
// Wait a little bit before we loop around and do it again
delay(20);
}
// Now go in the other direction.
for(int i = NUM_LEDS-1; i >= 0; i--) {
for(int x = 0; x < NUM_STRIPS; x++) {
// Set the i'th led to red
leds[x][i] = CRGB::Blue;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::Black;
// Wait a little bit before we loop around and do it again
delay(20);
}
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
for(int x = 0; x < NUM_STRIPS; x++) {
// Set the i'th led to red
leds[x][i] = CRGB::Red;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::White;
// Wait a little bit before we loop around and do it again
delay(20);
}
// Now go in the other direction.
for(int i = NUM_LEDS-1; i >= 0; i--) {
for(int x = 0; x < NUM_STRIPS; x++) {
// Set the i'th led to red
leds[x][i] = CRGB::White;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::Red;
// Wait a little bit before we loop around and do it again
delay(20);
}
// Now go in the other direction.
for(int i = NUM_LEDS-1; i >= 0; i--) {
for(int x = 0; x < NUM_STRIPS; x++) {
// Set the i'th led to red
leds[x][i] = CRGB::Red;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::White;
// Wait a little bit before we loop around and do it again
delay(20);
}
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
for(int x = 0; x < NUM_STRIPS; x++) {
// Set the i'th led to red
leds[x][i] = CRGB::Blue;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[x][i] = CRGB::Blue;
// Wait a little bit before we loop around and do it again
delay(20);
}
}
//AN ERROR COMES AT THE END SAYING "EXPECTED '}' AT THE END OF THE INPUT " DON'T KNOW TO FIX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment