Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 3
- #define NUM_LEDS 25
- #define BRIGHTNESS 30
- #define FRAMES_PER_SECOND 120
- CRGB leds[NUM_LEDS];
- int timer = 125;
- #define row_segment 5
- #define led_per_row_segment 5
- int row1[]={20, 21, 22, 23, 24}; uint8_t size_frame1 = sizeof(row1) / sizeof(row1[0]);
- int row2[]={19, 18, 17, 16, 15}; uint8_t size_frame2 = sizeof(row2) / sizeof(row2[0]);
- int row3[]={10, 11, 12, 13, 14}; uint8_t size_frame3 = sizeof(row3) / sizeof(row3[0]);
- int row4[]={9, 8, 7, 6, 5}; uint8_t size_frame4 = sizeof(row4) / sizeof(row4[0]);
- int row5[]={0, 1, 2, 3, 4}; uint8_t size_frame5 = sizeof(row5) / sizeof(row5[0]);
- int ROW_segment[ row_segment][led_per_row_segment]={
- {0, 1, 2, 3, 4},
- {9, 8, 7, 6, 5},
- {10, 11, 12, 13, 14},
- {19, 18, 17, 16, 15},
- {20, 21, 22, 23, 24} };
- uint8_t size_segment = sizeof(ROW_segment) / sizeof(ROW_segment[0]);
- void setup() {
- LEDS.delay(2000); // 2 second delay for recovery
- LEDS.setBrightness(BRIGHTNESS);
- LEDS.addLeds<NEOPIXEL, LED_PIN>(leds, 0, NUM_LEDS).setCorrection(TypicalLEDStrip);
- }
- void loop() {
- solid();
- }
- void solid() {
- // row 3 fill color //fill_solid(leds,NUM_LEDS, CRGB(0,0,30))
- fill_solid(leds[row3[led_per_row_segment]],size_frame3, CRGB::Blue);
- LEDS.show();
- LEDS.delay(timer);
- LEDS.clear();
- }
- void chase_row(){
- for (int i = 0; i < led_per_row_segment; ++i)
- {
- fadeToBlackBy(leds, NUM_LEDS, 150);
- leds[row1[i]] = CRGB::Red;
- leds[row2[i]] = CRGB::Red;
- leds[row3[i]] = CRGB::Red;
- leds[row4[i]] = CRGB::Red;
- leds[row5[i]] = CRGB::Red;
- LEDS.show();
- LEDS.delay(timer);
- }
- }
Add Comment
Please, Sign In to add comment