Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- #define NUM_LEDS 160
- // Data pin that led data will be written out over
- #define DATA_PIN 5
- // This is an array of leds. One item for each led in your strip.
- CRGB leds[NUM_LEDS];
- // This function sets up the ledsand tells the controller about them
- void setup() {
- // sanity check delay - allows reprogramming if accidently blowing power w/leds
- delay(2000);
- FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
- }
- void loop() {
- int Array[2];
- Array[0] = CRGB::White;
- Array[1] = CRGB::Red;
- // and so on
- for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
- leds[whiteLed] = Array[0]; // THIS WORKES: leds[whiteLed] = CRGB::Red;
- // Show the leds (only one of which is set, from above)
- FastLED.show();
- // Wait a little bit
- delay(50);
- /*if number = 1;
- number = 0;
- if number = 0;
- number =1; */
- // Turn our current led back to black for the next loop around
- leds[whiteLed] = CRGB::Black;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement