diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-11-04 04:20:37 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-11-04 04:20:37 +0300 |
commit | 6092cad72f8c9439b42d513b5caf4230c6c83ac7 (patch) | |
tree | 9d1f02df5dff3e801ce96cab8a26327455dc772a /examples | |
parent | f04ed32ab3ebc1a21b35a3d912c419d8b310eaed (diff) |
Make the due interrupt friendly and get it off the SysTick timer.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Cylon/Cylon.ino | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino index 56e2d1d5..76046b41 100644 --- a/examples/Cylon/Cylon.ino +++ b/examples/Cylon/Cylon.ino @@ -10,9 +10,11 @@ #define CLOCK_PIN 13 // Define the array of leds -CRGB leds[40]; +CRGB leds[NUM_LEDS]; void setup() { + Serial.begin(57600); + Serial.println("resetting"); LEDS.addLeds<NEOPIXEL,DATA_PIN>(leds,NUM_LEDS); LEDS.setBrightness(84); } @@ -20,8 +22,8 @@ void setup() { void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } } void loop() { - uint8_t hue = 0; - // Serial.print("x"); + static uint8_t hue = 0; + Serial.print("x"); // First slide the led in one direction for(int i = 0; i < NUM_LEDS; i++) { // Set the i'th led to red @@ -32,8 +34,9 @@ void loop() { // leds[i] = CRGB::Black; fadeall(); // Wait a little bit before we loop around and do it again - delay(100); + delay(10); } + Serial.print("x"); // Now go in the other direction. for(int i = (NUM_LEDS)-1; i >= 0; i--) { @@ -45,6 +48,6 @@ void loop() { // leds[i] = CRGB::Black; fadeall(); // Wait a little bit before we loop around and do it again - delay(100); + delay(10); } } |