There are a lot of ways you can make this code your own - I encourage you to play around with it and add new features.

Change the colors

There are lots of great NeoPixel CircuitPython code examples out there. Modify the code to do different kinds of color cycling or animation!

It's simple to add new color modes to this code, just don't forget to change the following line to increase the number of modes available:

if color_mode > 2: color_mode = 0

Add new interactions

The ADXL343 is capable of detecting more than just taps - you can just as simply detect double-taps and free-fall as well. Can you use these modes for more interactivity?

We've also just used the buttons in a simple way. Can you change the button presses to be more sophisticated, and perhaps change the color of the grains in cleverer ways?

Add more sounds

I just used one sound - can you add more sounds for different types of grain interactions? Maybe a sound for grain collisions?

Make it faster

This is not very optimized code, as has been noted before, this should perhaps be called 'grains of snow' rather than 'grains of sand' due to their sluggish movement. Can you make it run faster?

Break it!

Most of all, I encourage you just to get into the code and break things. Failure is the greatest teacher, and many of us got started in electronics and coding by breaking things others have built and having to put them back together (sorry Mom and Dad). I'd love to see what you do with this code, and please drop me a line if you do something with it, or simply just enjoy it!

This guide was first published on Feb 13, 2019. It was last updated on Jul 18, 2024.

This page (Next Steps) was last updated on Mar 08, 2024.

Text editor powered by tinymce.