Advertisement
Guest User

Untitled

a guest
May 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1.     #include <FastLED.h>
  2.     #define LED_PIN     3
  3.     #define NUM_LEDS    60
  4.     CRGB leds[NUM_LEDS];
  5.     int x = 0;
  6.     void setup() {
  7.       FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  8.      
  9.     }
  10.     void loop() {
  11.       leds[x] = CRGB(255, 0, 0);
  12.       FastLED.show();
  13.       delay(2);
  14.       leds[x] = CRGB(0, 255, 0);
  15.       FastLED.show();
  16.       delay(2);
  17.       leds[x] = CRGB(0, 0, 255);
  18.       FastLED.show();
  19.       delay(2);
  20.       leds[x] = CRGB(255, 255, 255);
  21.       FastLED.show();
  22.       delay(10);
  23.       leds[x] = CRGB(255, 75, 0);
  24.       FastLED.show();
  25.       delay(10);
  26.       x = x + 1;
  27.       if (x > NUM_LEDS -1){
  28.         for (int i=0; i < NUM_LEDS; i++){
  29.           leds[x] = CRGB(0, 0, 0);
  30.           x = x - 1;
  31.           }
  32.         x = 0;
  33.         }
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement