Falling PixelSand on T-Display S3 ESP32
I make and sell NeoIumn8 which is a dynamic rear LED strip with a number of sequences made for various years of the Mazda Miata ND2+. For my own ND2, I built wireless controller to remotely change the sequences and have some fun with it. It’s mounted in the right side dash vent. One of the screens takes advantage of an accelerometer to move a doughnut around on the screen (mmmm dooonuts!). I came across this PixelDust example and said to myself, self, let’s do that too and have it dump pixel dust across the screen as I’m hitting some of the fun roads in the yata. because why not?!
After digging around, I found an Adafruit library that focuses on LED matrices, and there was also one for a TFT, but is not easily modifiable. I later came across this library by Bill over on Github and, with some quick tweaks, modified it to work with the LilyGo T-Display S3 with the Arduino_GFX library. Full credit to Bill please, as most of this is his code. I’m not done yet, but I’ve tweaked it so it can be #included as a library on it’s own to reduce clutter. The main code only needs a few parameters and declarations. This version uses touch to initiate the sand falling but can easily be modified to work with an accelerometer. There’s also an option to build the “hill” as the pixels drop to the bottom using doPixelSand(1) instead of doPixelSand(0).
The below code works for the LilyGo T-Display S3 display, and on the GFX for Arduino library but should be easily modifiable for TFT e_SPI or others display drivers. I was also able to easily port it over to the LilyGo T-Display Amoled. The code was built on PlatformIO but can easily be modified to work in the Arduino IDE.
Comments: