Created
November 24, 2015 19:22
-
-
Save kriegsman/261beecba85519f4f934 to your computer and use it in GitHub Desktop.
"sinelon" with no visual gaps at any speed or pixel count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated sinelon (no visual gaps) | |
void sinelon() | |
{ | |
// a colored dot sweeping | |
// back and forth, with | |
// fading trails | |
fadeToBlackBy( leds, NUM_LEDS, 20); | |
int pos = beatsin16(13,0,NUM_LEDS); | |
static int prevpos = 0; | |
if( pos < prevpos ) { | |
fill_solid( leds+pos, (prevpos-pos)+1, CHSV(gHue,220,255)); | |
} else { | |
fill_solid( leds+prevpos, (pos-prevpos)+1, CHSV( gHue,220,255)); | |
} | |
prevpos = pos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment