Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Garcia <danielgarcia@gmail.com>2013-11-11 04:28:55 +0400
committerDaniel Garcia <danielgarcia@gmail.com>2013-11-11 04:28:55 +0400
commitbbe1cb7b674a331e79f18ff90ee2d4f1d5a06316 (patch)
tree508501305ccc456044beb67569e90194484e5615 /examples/Cylon
parentc32efdbe2a420f9fd6708558e9ffc4c0f3e2fe6e (diff)
Adding a new cylon eye type example
Diffstat (limited to 'examples/Cylon')
-rw-r--r--examples/Cylon/Cylon.ino43
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino
new file mode 100644
index 00000000..96b6ac59
--- /dev/null
+++ b/examples/Cylon/Cylon.ino
@@ -0,0 +1,43 @@
+#include "FastLED.h"
+
+// How many leds in your strip?
+#define NUM_LEDS 6
+
+// 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 11
+#define CLOCK_PIN 13
+
+// Define the array of leds
+CRGB leds[NUM_LEDS];
+
+void setup() {
+ FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
+}
+
+void loop() {
+ // First slide the led in one direction
+ for(int i = 0; i < NUM_LEDS; i++) {
+ // Set the i'th led to red
+ leds[i] = CRGB::Red;
+ // Show the leds
+ FastLED.show();
+ // now that we've shown the leds, reset the i'th led to black
+ leds[i] = CRGB::Black;
+ // Wait a little bit before we loop around and do it again
+ delay(30);
+ }
+
+ // Now go in the other direction.
+ for(int i = NUM_LEDS-1; i >= 0; i--) {
+ // Set the i'th led to red
+ leds[i] = CRGB::Red;
+ // Show the leds
+ FastLED.show();
+ // now that we've shown the leds, reset the i'th led to black
+ leds[i] = CRGB::Black;
+ // Wait a little bit before we loop around and do it again
+ delay(30);
+ }
+} \ No newline at end of file