Guest User

Fastled Test code

a guest
Mar 23rd, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.03 KB | None | 0 0
  1. // Uncomment this line if you have any interrupts that are changing pins - this causes the library to be a little bit more cautious
  2. // #define FAST_SPI_INTERRUPTS_WRITE_PINS 1
  3.  
  4. // Uncomment this line to force always using software, instead of hardware, SPI (why?)
  5. // #define FORCE_SOFTWARE_SPI 1
  6.  
  7. // Uncomment this line if you want to talk to DMX controllers
  8. // #define FASTSPI_USE_DMX_SIMPLE 1
  9.  
  10. #include "FastLED.h"
  11.  
  12.  
  13. #define NUM_LEDS 50
  14.  
  15. #define DATA_PIN 6
  16.  
  17. #define CLOCK_PIN 8
  18.  
  19. CRGB yourcolor = 0xff0000; //fade to this
  20.  
  21. void setup() {
  22.     // sanity check delay - allows reprogramming if accidently blowing power w/leds
  23.     delay(2000);
  24.  
  25.     // For safety (to prevent too high of a power draw), the test case defaults to
  26.     // setting brightness to 25% brightness
  27.     LEDS.setBrightness(64);
  28.    
  29.    FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  30.  
  31.     // LEDS.addLeds<WS2811, 13>(leds, NUM_LEDS);
  32.     // LEDS.addLeds<TM1809, 13>(leds, NUM_LEDS);
  33.     // LEDS.addLeds<UCS1903, 13>(leds, NUM_LEDS);
  34.     // LEDS.addLeds<TM1803, 13>(leds, NUM_LEDS);
  35.  
  36.     // LEDS.addLeds<P9813>(leds, NUM_LEDS);
  37.     //CLEDController *pLed = new ClocklessController_Trinket<4, NS(400), NS(400), NS(450), GRB>();
  38.     //LEDS.addLeds(pLed, leds, NUM_LEDS);
  39.     // LEDS.addLeds<LPD8806>(leds, NUM_LEDS);
  40.     // LEDS.addLeds<WS2801>(leds, NUM_LEDS);
  41.     // LEDS.addLeds<SM16716>(leds, NUM_LEDS);
  42.  
  43.     // LEDS.addLeds<WS2811, 11>(leds, NUM_LEDS);
  44.  
  45.     // Put ws2801 strip on the hardware SPI pins with a BGR ordering of rgb and limited to a 1Mhz data rate
  46.     // LEDS.addLeds<WS2801, 11, 13, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS);
  47.  
  48.     // LEDS.addLeds<LPD8806, 10, 11>(leds, NUM_LEDS);
  49.     // LEDS.addLeds<WS2811, 13, BRG>(leds, NUM_LEDS);
  50.     // LEDS.addLeds<LPD8806, BGR>(leds, NUM_LEDS);
  51. }
  52.  
  53. void loop() {
  54.  
  55. for (int i=0;i<256;i++){
  56.   for (int j=0; j< numLeds; j++){
  57.     leds [j] = yourcolor.nscale8_video(i);
  58.   }
  59. }
  60. for (int i=255;i>=0;i--){
  61.   for (int j=0; j< numLeds; j++){
  62.     leds [j] = yourcolor.nscale8_video(i);
  63.   }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment