Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void spiral2() {
- static uint8_t stripIndex = 0;
- static uint8_t dotIndex = 0;
- // first, dim all LEDs, every time
- for (int x = 0; x < NUM_STRIPS; x++) {
- for (int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
- leds [x][i].fadeToBlackBy(64);
- }
- }
- // then, once per X milliseconds, light up the next LED
- EVERY_N_MILLISECONDS(1000) {
- leds[stripIndex][dotIndex] = CHSV( gHue + random8(64), 200, 255);
- // move to the next strip
- stripIndex++;
- // wrap back to the first strip
- if (stripIndex >= NUM_STRIPS) {
- stripIndex = 0;
- }
- // move to the next LED
- dotIndex++;
- // wrap back to the first LED
- if (dotIndex >= NUM_LEDS_PER_STRIP) {
- dotIndex = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment