In this blog post, I would like to explore how to make a Tron animation using an RGB light strip.
Okay maybe not as cool as these but it should look like something similar.
Video:
https://youtu.be/klFLwEilRKg
In order to create a Tron-like light trail animation, the neopixels will have to turn on and off individually from one pixel to another. Pressing button A on CPX will initiate an animation running in one direction; pressing button B, the light will run in the opposite direction.
Make code:
What worked?
In make code, I made a for loop that creates an index that the CPX will use to refer to the pixels’ positions. (index 0 = pixel 1, index 1 = pixel 2, etc.) The for loop will count from 0 to 20, which is the total number of pixel on my light strip, creating the animation. At the same time, I added two lines of code in JS mode (strip.setPixelBrightness(index+1,255),(index-1, Fade)) to make the first light the brightest and the fading the brightness of the two following pixels aim to create the fading tail.
For the opposite direction, the code has to be inverted but there is no way to create a for loop with the descending count. So again, I made this function in JS, which worked perfectly running in the opposite direction!
What didn’t work?
The fading effect for the tail worked only for the first button push. For some reasons, the light trail (the two following fading pixels) won’t show the second time running the animation. The problem is still not resolved…