Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- // How many leds in your strip?
- #define NUM_LEDS 50
- // For led chips like WS2812, which have a data line, ground, and power, you just
- // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
- // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
- // Clock pin only needed for SPI based chipsets when not using hardware SPI
- #define DATA_PIN 6
- #define CLOCK_PIN 13
- // Define the array of leds
- CRGB leds[NUM_LEDS];
- void setup() {
- FastLED.addLeds<WS2811, DATA_PIN, BRG>(leds, NUM_LEDS);
- //the amazon page specifies that these ICs expect data in BRG format, though I've tried to run the code with other formats too with the same result
- }
- void loop() {
- // Turn the LED on, then pause
- leds[0] = CRGB::Red;
- FastLED.show();
- delay(500);
- // Now turn the LED off, then pause
- leds[0] = CRGB::Black;
- FastLED.show();
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement