Teensy 2.0
The Teensy 2.0 showed up in the mail today! Here it is, nice and small:
It took me less than two hours to get a working gamepad in both Windows and Linux. I had found some code online that modified Teensy’s keyboard example to be an SNES gamepad, so a lot of the work was already done. However, the NES and SNES controllers have a chip that communicates over 4 wires to the console using a simple protocol. (I’ll include some fun trivia about the NES/SNES at the end of this post). This code I found used that protocol to communicate with the chip inside the controller. In order to make my gamepads all consistent and not have to worry about timing with the NES chip/protocol, I stripped all of that out and modified it to manually read from the Teensy’s input pins, one for each button.
Once I got it all working, I could plug the USB port in and have a gamepad with 2 axis and 8 buttons (just like the SNES). And I verified that I could use whatever name I want the gamepad to show up as:
The only thing left was to test that it can actually fit inside an NES controller, and it does, sort of. It is maybe 2 sheets of paper too tall, which will probably be okay as long as I can make sure the wires soldered into the holes do not protrude any. Otherwise, I will need to remove the USB connector from the Teensy and solder the USB wires on directly.
Next, I’ll be working on the base code I will use to create each gamepad.
Fun Nintendo Controller Trivia:
The NES and SNES controllers actually use the same exact protocol for communicating with the console. It is very electrically simple, and supports infinite buttons. The console just keeps querying each button until its done. The first eight buttons on the SNES are the same as the NES controller: Up, Down, Left, Right, Select, Start, B, and A. So if you connected the wires of an SNES controller to the NES, it would actually work. The NES queries 8 buttons and then stops. The only downside is the placement of B and A on the SNES controller don’t lend well to pressing the B and A buttons simultaneously with your thumb like you do in Super Mario Bros., etc. The SNES console queries the additional X, Y, L, and R buttons after the first eight.
Next Post: Gamepad Teensy Code