A Tale of Two (three) Pongs

Created 2 April 2009, updated 1 Nov 2020

When I start learning a new  platform, I have a simple rule: If you don’t know what to do with it, make pong. What I love about pong is that it’s a simple rule set, easy to understand, and implementable on just about anything with a pixel display.  You can generally implement it in a day or less on any platform. And it’s a great example of engaging interaction.  People understand what’s going on right away, and, when implemented well, it’s just challenging enough to keep you engaged for several minutes at least.  That’s good interaction, to me.

I’m a big believer in starting with the application rather than the platform.  I think you do better work when the tools serve the need rather than the other way around.  But sometimes you get stuck with the assignment to learn a particular platform or tool, and you have to make up a project on the spot.  When that happens, make pong.

As an example of this, I built pong for two platforms yesterday [1 April 2009]: an Arduino Mega with 2 8×8 LED matrices (based on my earlier post), and Processing.  Since Arduino’s programming syntax was based closely on Processing’s, I figured it should be possible to port the code from one to the other pretty quickly. It took about ten minutes to go from Arduino to Processing.  In 2020, I updated this exercise to write the program in p5.js as well. Following, I’ll describe the thought process of putting the game together for all three, as a hopeful aid to beginning programmers.

Continue reading “A Tale of Two (three) Pongs”

Writing to Mifare RFID tags

Mifare RFID tags, like other RFID tags, contain a serial number that can be read using an RFID reader, but they also have a limited amount of memory space that you can write data to, and read back from.  This can be handy if you want to do something like keep a user’s account balance or name directly on the RFID tag.

This tutorial shows a number of the functions of my sonMicroReader  library for Processing, including how to write to the memory on tags.  It uses the same circuit as the SM130 reader example. The entire sketch can be downloaded here:

sonmicro_writer_0001

Continue reading “Writing to Mifare RFID tags”

Reading Mifare RFID Tags

This tutorial explains how to read from Mifare RFID tags from your computer using a Sonmicro SM130 read/write module. The sketch below is written in Processing using my SonmicroReader library. The SM130 has a TTL serial interface that you can connect to a micocontroller, or to a personal computer through a USB-to-serial interface.  Using the latter, it’s pretty simple to send serial commands to it and receive the data back. The entire Processing sketch can be downloaded here: rfid_simple_0001.

Continue reading “Reading Mifare RFID Tags”