Advertisement
Guest User

LEdStripe

a guest
Aug 8th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. #define NUM_LEDS 160
  4.  
  5. // Data pin that led data will be written out over
  6. #define DATA_PIN 5
  7.  
  8. // This is an array of leds.  One item for each led in your strip.
  9. CRGB leds[NUM_LEDS];
  10.  
  11. // This function sets up the ledsand tells the controller about them
  12.  
  13.  
  14. void setup() {
  15.     // sanity check delay - allows reprogramming if accidently blowing power w/leds
  16.     delay(2000);
  17.     FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  18. }
  19.  
  20.  
  21.  
  22. void loop() {
  23.  
  24.   int Array[2];
  25.       Array[0] = CRGB::White;
  26.       Array[1] = CRGB::Red;
  27.       // and so on
  28.    
  29.    for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
  30.    
  31.       leds[whiteLed] = Array[0]; // THIS WORKES: leds[whiteLed] = CRGB::Red;
  32.       // Show the leds (only one of which is set, from above)
  33.       FastLED.show();
  34.       // Wait a little bit
  35.       delay(50);
  36.       /*if number = 1;
  37.         number = 0;
  38.       if number = 0;
  39.         number =1; */
  40.       // Turn our current led back to black for the next loop around
  41.       leds[whiteLed] = CRGB::Black;
  42.    }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement