Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Ajuggle()
- {
- static uint8_t numdots = 7; // Number of dots in use.
- static uint8_t faderate = 2; // How long should the trails be. Very low value = longer trails.
- static uint8_t basebeat = 5;
- uint8_t blurAmount = dim8_raw( beatsin8(3,64, 172) ); // A sinewave at 3 Hz with values ranging from 64 to 192.
- blur1d( leds, NUM_LEDS, blurAmount); // Apply some blurring to whatever's already on the strip, which will eventually go black.
- static uint8_t lastSecond = 99; // Static variable, means it's only defined once. This is our 'debounce' variable.
- uint8_t secondHand = (millis() / 1000) % 30; // IMPORTANT!!! Change '30' to a different value to change duration of the loop.
- if (lastSecond != secondHand) { // Debounce to make sure we're not repeating an assignment.
- lastSecond = secondHand;
- switch (secondHand) {
- case 0: basebeat = 7; faderate = 12; break; // You can change values here, one at a time , or altogether.
- case 10: basebeat = 5; faderate = 24; break;
- case 20: basebeat = 3; faderate = 32; break; // Only gets called once, and not continuously for the next several seconds. Therefore, no rainbows.
- case 30: break;
- }
- }
- // Several colored dots, weaving in and out of sync with each other
- // curhue = thishue; // Reset the hue values.
- fadeToBlackBy(leds, NUM_LEDS, faderate);
- for ( int i = 0; i < numdots; i++) {
- //beat16 is a FastLED 3.1 function
- leds[beatsin16(basebeat + i + map(spectrumByte[i],0,255,1,5), 0, NUM_LEDS)] += CHSV(i*40 + map(spectrumByte[i],0,255,1,20), 255, map(spectrumByte[i],0,255,30,255));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment