Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LED strip group
- #include "FastLED.h"
- #define NUM_LEDS 39 // Number of LEDs
- #define COLOR_ORDER RGB // Define color order for your strip
- #define DATA_PIN 6 // Data pin for led comunication
- CRGB leds[NUM_LEDS]; // Define LEDs strip
- uint32_t ledColor = 0x0FF000; // Color used (in hex)
- uint32_t ledOff = 0x000000; // LED "off" color used (in hex)
- void setup() {
- LEDS.addLeds<WS2812, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // Set LED strip type
- LEDS.setBrightness(64); // Set initial brightness
- }
- void loop(){
- // One at a time
- for (byte b=0;b<9;b++){
- //set LEDs
- groupout(b,ledColor);
- FastLED.show(); // Display leds array
- delay(800);// wait a bit
- // blank the same ones
- groupout(b,ledOff);
- }
- // all on
- for (byte b=0;b<9;b++){
- groupout(b,ledColor);
- }
- FastLED.show(); // Display leds array
- delay(800);// you get the drill
- for (byte b=0;b<9;b++){
- groupout(b,ledOff);
- }
- }
- // set group of 4 LEDs
- void groupout(byte position,uint32_t color) {
- for (byte i = 0; i < 4; i++) {
- leds[(4*position)+i] = color;
- }// close for i loop
- }
Advertisement
Add Comment
Please, Sign In to add comment