It now plays Pong

This week's big achievement was getting Pong running on the Dazzler. The game itself is running in Python, on SPIDriver or the Adafruit Metro. About 100 lines of game code runs the joystick loop and draw the graphics.

This image was deleted by MailChimp when they shut down TinyLetter.
Quite a few components had to be done to get to this point. The Dazzler's onboard J1 CPU was part of it. It handles some of the Dazzler's housekeeping, like putting up the boot screen, but also drives the joystick sensing.

Wii "classic" controllers are maker-friendly. They talk over I²C, the pinout and register map are published, so you can decode its buttons and sticks as a compact 6-byte block:

This image was deleted by MailChimp when they shut down TinyLetter.
A couple of months ago I bought an adapter and wrote an I²CDriver module to read it. Straightforward enough, but a small problem is that the controller is always at I²C address 0x52, so if you want to use two of them you need to have two I²C busses.


Here's how the Dazzler simplifies things. The Dazzler's onboard J1 CPU does have dual I²C busses. It scans the two controllers and reads out the 6-byte settings block. These then appear at fixed addresses in the Dazzler's memory map. So the game code can get the current state of both controllers just by reading some bytes over SPI. Less fuss, more fun!


That's it for this week. It was actually quite enjoyable writing Pong - and keeping it short. If you have a suggestion for a next (tiny) demo game, hit reply and let me know. Thanks!