The approach used in the Knight Rider sketch allows for lots of variations. Tweaking the brightness function will give various nice effects.
uint8_t brightness(const int8_t led, const int8_t pos) { switch (min(abs(led-pos),abs(19-led-pos))) { case 0: return 32; case 1: return 16; case 2: return 6; case 3: return 2; default: return 1; } }
Replacing the brightness function as indicated above will give 2 cursors move back and forth.
Another nice effect is achieved with the following brightness function.
uint8_t brightness(const int8_t led, const int8_t pos) { int8_t tmp = pos - abs(2*led-19)+2; return (tmp>0? tmp+tmp>>1: 0); }
It delivers some “glowing” blink effect.
What is the coolest effect you can create? Once you finish playing with these effects go on to the persistence of vision experiments.