Guest User

FAST_LED_2.1_quick and dirty strobe

a guest
Oct 18th, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. // How many leds in your strip?
  4. #define NUM_LEDS 300
  5.  
  6. // For led chips like Neopixels, which have a data line, ground, and power, you just
  7. // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
  8. // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
  9. #define DATA_PIN 6
  10. #define CLOCK_PIN 13
  11.  
  12.  
  13. CRGB leds[NUM_LEDS];
  14.  
  15. long sthalf = (NUM_LEDS/2);
  16. long sthalf2 = (NUM_LEDS); //THIS IS WHERE I'M HAVING TROUBLE
  17.  
  18. void setup() {
  19. // Uncomment/edit one of the following lines for your leds arrangement.
  20. // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
  21. // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
  22. // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
  23. // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  24. // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
  25. FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  26. // FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS);
  27. // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  28.  
  29. // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
  30. // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
  31. // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
  32.  
  33. // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  34. // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  35. // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  36. }
  37.  
  38. void loop(){
  39. fill_solid(leds, sthalf, CRGB::White);
  40. FastLED.show();
  41. delay(20);
  42. fill_solid(leds, NUM_LEDS, CRGB::Black);
  43.  
  44. FastLED.show();
  45. delay(1000);
  46.  
  47. fill_solid(leds, sthalf2, CRGB::White);
  48. FastLED.show();
  49. delay(20);
  50. fill_solid(leds, sthalf2, CRGB::Black);
  51.  
  52. FastLED.show();
  53. delay(1000);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment