Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_TYPE WS2812B // type of RGB LED's
- #define COLOR_ORDER GRB // sequence of color
- #define NUM_LEDS 300 // # of LED's
- #define LED_PIN 2 // data pin on Arduino
- #define BRIGHTNESS 200 // brightness range [0-255]
- CRGB leds[NUM_LEDS]; // array for RGB control
- void setup()
- {
- FastLED.setMaxRefreshRate(0);
- FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); // initializing definitions
- FastLED.setBrightness(BRIGHTNESS); // intializing brightness
- }
- void loop()
- {
- CRGB TurnOnColor = CRGB::Blue; // setting desired color
- CRGB TurnOffColor = CRGB::Black; // turning off LED
- int i; // intializing counter
- int StripLength = 60; // Length of the chasing strip
- for (i = 0; i < StripLength; i++)
- {
- leds[i] = TurnOnColor;
- FastLED.show();
- }
- for (i = StripLength; i < NUM_LEDS; i++)
- {
- leds[i] = TurnOnColor;
- leds[i-StripLength] = TurnOffColor;
- FastLED.show();
- }
- for(i = NUM_LEDS-StripLength; i <NUM_LEDS; i++)
- {
- leds[i] = TurnOffColor;
- FastLED.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment