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:
authordanielgarcia@gmail.com <danielgarcia@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b>2013-07-24 00:49:25 +0400
committerdanielgarcia@gmail.com <danielgarcia@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b>2013-07-24 00:49:25 +0400
commita4e167e6adce05ebaac2dda3f8abfae07393f174 (patch)
treefcd4da4819d3d8325f8dbf3211136ce0902265d4 /examples/FirstLight/FirstLight.ino
parent9d6be4506c179990b6035e08aa8a2e415badf715 (diff)
Simple first light program for people to play with
Diffstat (limited to 'examples/FirstLight/FirstLight.ino')
-rw-r--r--examples/FirstLight/FirstLight.ino61
1 files changed, 61 insertions, 0 deletions
diff --git a/examples/FirstLight/FirstLight.ino b/examples/FirstLight/FirstLight.ino
new file mode 100644
index 00000000..28258b52
--- /dev/null
+++ b/examples/FirstLight/FirstLight.ino
@@ -0,0 +1,61 @@
+#include "FastSPI_LED2.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////
+//
+// Move a white dot along the strip of leds. This program simply shows how to configure the leds,
+// and then how to turn a single pixel white and then off, moving down the line of pixels.
+//
+
+// How many leds are in the strip?
+#define NUM_LEDS 40
+
+// Data pin that led data will be written out over
+#define DATA_PIN 6
+
+// Clock pin only needed for SPI based chipsets when not using hardware SPI
+//#define CLOCK_PIN 8
+
+// This is an array of leds. One item for each led in your strip.
+CRGB leds[NUM_LEDS];
+
+// This function sets up the ledsand tells the controller about them
+void setup() {
+ // sanity check delay - allows reprogramming if accidently blowing power w/leds
+ delay(2000);
+
+ // Uncomment one of the following lines for your leds arrangement.
+ // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
+ FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
+
+ // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
+
+ // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+ // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+}
+
+// This function runs over and over, and is where you do the magic to light
+// your leds.
+void loop() {
+ // Move a single white led
+ for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
+ // Turn our current led on to white, then show the leds
+ leds[whiteLed] = CRGB::White;
+
+ // Show the leds (only one of which is set to white, from above)
+ FastLED.show();
+
+ // Wait a little bit
+ delay(100);
+
+ // Turn our current led back to black for the next loop around
+ leds[whiteLed] = CRGB::Black;
+ }
+} \ No newline at end of file