diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-04-01 22:26:31 +0400 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-04-01 22:26:31 +0400 |
commit | f5a0df8d0e69febc9d58db83ad9e13a8c677122c (patch) | |
tree | 7ba63949392b7b6fba0435dee136ecf5c6e5f30a /examples/Cylon | |
parent | 7f37062fcb808ecfc7efc549343bc07508cc5876 (diff) |
Adding block controllers for arm k20/sam clockless chips
Diffstat (limited to 'examples/Cylon')
-rw-r--r-- | examples/Cylon/Cylon.ino | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino index dfb6ed78..ea102095 100644 --- a/examples/Cylon/Cylon.ino +++ b/examples/Cylon/Cylon.ino @@ -1,7 +1,7 @@ #include "FastLED.h" // How many leds in your strip? -#define NUM_LEDS 40 +#define NUM_LEDS 64 // 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, @@ -10,34 +10,53 @@ #define CLOCK_PIN 13 // Define the array of leds -CRGB leds[NUM_LEDS]; +CRGB leds[(NUM_LEDS * 16)+1]; void setup() { - FastLED.addLeds<NEOPIXEL,DATA_PIN>(leds, NUM_LEDS); + Serial.begin(19200); + delay(3000); + Serial.println("resetting"); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + delay(500); Serial.print("."); + LEDS.addLeds<WS2811_PORTC,24>(leds, NUM_LEDS); // .setDither(DISABLE_DITHER); + // LEDS.addLeds<NEOPIXEL,33>(leds,NUM_LEDS); + Serial.println("Entering loopx"); } +void fadeall() { for(int i = 0; i < NUM_LEDS*16; i++) { leds[i].nscale8(250); } } + void loop() { + uint8_t hue = 0; + // Serial.print("x"); // First slide the led in one direction - for(int i = 0; i < NUM_LEDS; i++) { + for(int i = 0; i < NUM_LEDS*5; i++) { // Set the i'th led to red - leds[i] = CRGB::Red; + leds[i] = CHSV(hue++, 255, 255); // Show the leds - FastLED.show(); + FastLED.show(); // now that we've shown the leds, reset the i'th led to black - leds[i] = CRGB::Black; + // leds[i] = CRGB::Black; + fadeall(); // Wait a little bit before we loop around and do it again - delay(30); + delay(10); } // Now go in the other direction. - for(int i = NUM_LEDS-1; i >= 0; i--) { + for(int i = (NUM_LEDS*5)-1; i >= 0; i--) { // Set the i'th led to red - leds[i] = CRGB::Red; + leds[i] = CHSV(hue++, 255, 255); // Show the leds FastLED.show(); // now that we've shown the leds, reset the i'th led to black - leds[i] = CRGB::Black; + // leds[i] = CRGB::Black; + fadeall(); // Wait a little bit before we loop around and do it again - delay(30); + delay(10); } } |