Introduction: Arduino Snake on a VGA Monitor
Well... I bought an Arduino. Initially, the investment was motivated with something that would make my daughter interested in programming. However, as it turned out, this thing was more fun to play with for me.
After playing around with making LED's light up, button interaction and serial printing, I decided to set raise the bar a bit and actually make something. As one of my biggest interests is gaming it was naturally going to be something gaming-related, and therefore I decided to create my own little arcade machine. I quickly realized that the actual cabinet-building had to be a future project, and that I needed to focus on wrapping my head around programming with the limited resources that Arduino has to offer. So I decided that a good first game would be Snake.
In order to get started I had to wrap my head around how to solve input and display. For input I wanted a genuine arcade feeling, so I purchased an arcade joystick and buttons. Display was a bit trickier as I did not want to be limited to small TFT screens. I then found the awesome VGAX library by Sandro Maffiodo. However, since I had to solder my own VGA port, this meant that I had to revisit the art of soldering, something I've not done since school (more than 20 years ago).
So, without further talking, here is how I made my first Arduino project!
Step 1: Requirements
Step 2: Solder the VGA Port
I started by soldering the VGA port. The best instructions I could find for this was on Sandro Maffiodos VGAX page.
I noticed that it was easier to start solder the connections in the middle row on the VGA port. Starting with any of the other rows made it hard to reach the middle connections without solder off the existing connections (probably due to me having a big and cheap soldering iron).
Step 3: Connect Everything to the Arduino
I then connected everything to the Arduino. I made a fritzing chart above that you should be able to follow (warning, there are lots of cables that are easily tangled up together).
The VGAX library has support for 4 colors only, however you can choose among 6 different color schemes. These are defined by connecting the VGA cables for RGB in various combinations. Check out Sandro Maffiodos VGAX page to learn more.
Step 4: Upload the Game
The game source code is available on my GitHub.