Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 3
- #define NUM_LEDS 60
- CRGB leds[NUM_LEDS];
- int x = 0;
- void setup() {
- FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
- }
- void loop() {
- leds[x] = CRGB(255, 0, 0);
- FastLED.show();
- delay(2);
- leds[x] = CRGB(0, 255, 0);
- FastLED.show();
- delay(2);
- leds[x] = CRGB(0, 0, 255);
- FastLED.show();
- delay(2);
- leds[x] = CRGB(255, 255, 255);
- FastLED.show();
- delay(10);
- leds[x] = CRGB(255, 75, 0);
- FastLED.show();
- delay(10);
- x = x + 1;
- if (x > NUM_LEDS -1){
- for (int i=0; i < NUM_LEDS; i++){
- leds[x] = CRGB(0, 0, 0);
- x = x - 1;
- }
- x = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement