MicroPython code for a WiPy to animate Conway's Game Of Life on a circular LED disc.
To use this on a WiPy wired up with a 5V logic level shifter on its SPI bus connected to the Adafruit LED disc with sufficient power to drive all 255 LEDs:
import life
disc = life.Life(brightness=8)
disc.run()
I have the LEDs above a few cm behind some wax paper to diffuse the light.
The apa102
module is fairly generic and should be usable to control
any number of APA102 / DotStar LEDs on your SPI bus. I have attached
strands before and after the disc during my own testing. You may see
some other fun test code in there.
The neighbor relationships for the LEDs when mapped to this circular LED disc will greatly impact your LIFE. I got lucky with this definition but perhaps you can do better. Of particular interest in this universe is that not all LEDs have the same number of neighbors. This is very much not your typical two dimensional grid...
The code has experimental torus support. I found things tended to die off rapidly in that configuration as it destroyed the natural ring 1 circle of life.
TODO(gpshead) draw out how I have mine connected.
- A WiPy. Or likely anything capable of running MicroPython that exposes an SPI bus. I haven't tried anything else.
- A 74AHCT125 or similar to act as a logic level shifter from 3V3 to 5V.
- A 5V power supply sufficient to drive 255 LEDs. I'm using this 5V 10A supply. You could get away with less so long as you guarantee you never supply a high brightness value... But it is _A Bad Idea_™ to rely on software to prevent power supply damage.
- A prototyping breadboard, wires and connectors.