Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. //AndyMark, Inc.
  2. //Craig Kessler 12/3/2013, 3/17/2014, 3/20/2014
  3. //Edited by PerfectPixel AUS 21/12/2014, US 12/21/2014
  4.  
  5. #include "FastLED.h"
  6. #define NUM_LEDS 2 //How many cubes? (can be as many as your heart and budget desires)
  7. CRGB leds[NUM_LEDS];
  8. #define DATA_PIN 5 //What pin is going to output the data?
  9. #define CLOCK_PIN 13 //This is correct for the Arduino UNO however it could be different.
  10. #define MAX_BRIGHTNESS 255 //Just leave this.
  11. void setup()
  12. {
  13. // Uncomment one of the following lines for your leds arrangement.
  14.  
  15. // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
  16. // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
  17. // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
  18. FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  19. // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
  20. // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  21. // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  22. // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
  23. // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
  24. // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
  25. // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  26. // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  27. // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  28. }
  29. //-----------------------------------------------//
  30. void loop()
  31. {
  32. rainbow(15); //variable is the speed it fades
  33. }
  34. //-----------------------------------------------//
  35. void rainbow(uint8_t wait)
  36. {
  37.  
  38. uint16_t hue;
  39. FastLED.clear();
  40.  
  41. for(hue=10; hue<255*3; hue++)
  42. {
  43.  
  44. fill_rainbow( &(leds[0]), NUM_LEDS /*led count*/, hue /*starting hue*/);
  45. FastLED.show();
  46. delay(wait);
  47. }
  48. return;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement