This is a bit of a tangent for the joystick project, but I hit an itch an needed to scratch it.
Once I wrote the code for moving a cursor LED around on the matrix I immediately wanted to use it to draw. In my normal higher level languages this wouldn’t have been an issue, but I didn’t realize that C++ doesn’t have a concept of array push/pop/slice natively which made the idea of tracking the “on” state for multiple LEDs in the grid a bit more difficult.
Yeah I could have brought in a library to add the push/pop/slice functionality, but this is a learning exercise for me so I wanted to figure it out without the additional library.
So, I though out a way of translating the x,y of the cursor into an integer and using that to refer to a specific index of an array to track the on/off state of all LEDs in the matrix.
I grappled with it a bit and in the end figured out a decent way of handling it (which I’m sure I could have looked up somewhere but again, I’m using this as a learning exercise).
Every Thursday is #3dthursday here at Adafruit! The DIY 3D printing community has passion and dedication for making solid objects from digital models. Recently, we have noticed electronics projects integrated with 3D printed enclosures, brackets, and sculptures, so each Thursday we celebrate and highlight these bold pioneers!
Have you considered building a 3D project around an Arduino or other microcontroller? How about printing a bracket to mount your Raspberry Pi to the back of your HD monitor? And don’t forget the countless LED projects that are possible when you are modeling your projects in 3D!