Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- // Move a white dot along the strip of leds. This program simply shows how to configure the leds,
- // and then how to turn a single pixel white and then off, moving down the line of pixels.
- #define NUM_LEDS 300
- #define DATA_PIN 5
- // This is an array of leds. One item for each led in your strip.
- CRGB leds[NUM_LEDS];
- void setup() {
- delay(2000);
- FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
- void loop() {
- // Move a single white led
- for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
- // Turn our current led on to white, then show the leds
- leds[whiteLed] = CRGB::White;
- // Show the leds (only one of which is set to white, from above)
- FastLED.show();
- // Wait a little bit
- delay(100);
- // 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