Skip to content

Instantly share code, notes, and snippets.

@kriegsman
Created November 24, 2015 19:22
Show Gist options
  • Save kriegsman/261beecba85519f4f934 to your computer and use it in GitHub Desktop.
Save kriegsman/261beecba85519f4f934 to your computer and use it in GitHub Desktop.
"sinelon" with no visual gaps at any speed or pixel count
// 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