Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //AndyMark, Inc.
- //Craig Kessler 12/3/2013, 3/17/2014, 3/20/2014
- //Edited by PerfectPixel AUS 21/12/2014, US 12/21/2014
- #include "FastLED.h"
- #define NUM_LEDS 2 //How many cubes? (can be as many as your heart and budget desires)
- CRGB leds[NUM_LEDS];
- #define DATA_PIN 5 //What pin is going to output the data?
- #define CLOCK_PIN 13 //This is correct for the Arduino UNO however it could be different.
- #define MAX_BRIGHTNESS 255 //Just leave this.
- void setup()
- {
- // 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);
- }
- //-----------------------------------------------//
- void loop()
- {
- rainbow(15); //variable is the speed it fades
- }
- //-----------------------------------------------//
- void rainbow(uint8_t wait)
- {
- uint16_t hue;
- FastLED.clear();
- for(hue=10; hue<255*3; hue++)
- {
- fill_rainbow( &(leds[0]), NUM_LEDS /*led count*/, hue /*starting hue*/);
- FastLED.show();
- delay(wait);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement