Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- #define NUM_LEDS 16
- CRGB leds[NUM_LEDS];
- CRGB leds2[NUM_LEDS];
- #define PIN 6
- #define PIN2 7
- void setup()
- {
- FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
- FastLED.addLeds<WS2811, PIN2, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
- FastLED.setBrightness(175);
- }
- void loop()
- {
- for(int dot = -1; dot < NUM_LEDS; dot++)
- {
- leds[dot+2] = CRGB::White;
- FastLED.show();
- // clear this led for the next time around the loop
- leds[dot] = CRGB::Black;
- delay(75);
- }
- }
- void showStrip()
- {
- #ifdef ADAFRUIT_NEOPIXEL_H
- // NeoPixel
- strip.show();
- #endif
- #ifndef ADAFRUIT_NEOPIXEL_H
- // FastLED
- FastLED.show();
- #endif
- }
- void setPixel(int Pixel, byte red, byte green, byte blue)
- {
- #ifdef ADAFRUIT_NEOPIXEL_H
- // NeoPixel
- strip.setPixelColor(Pixel, strip.Color(red, green, blue));
- #endif
- #ifndef ADAFRUIT_NEOPIXEL_H
- // FastLED
- leds[Pixel].r = red;
- leds[Pixel].g = green;
- leds[Pixel].b = blue;
- #endif
- }
- void setAll(byte red, byte green, byte blue)
- {
- for(int i = 0; i < NUM_LEDS; i++ )
- {
- setPixel(i, red, green, blue);
- }
- showStrip();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement