View Full Version : Teensy 2.0 Arcade!

08-19-2013, 01:48 PM
After much work and struggling with all things USB, I've reached my first milestone on my Teensy Arcade board project. I figured now is a good time to share with the group!

This project creates a new Teensy 2.0 "board" within the IDE called "Keyboard + Joysticks (Arcade)" which gives you the following:

1 NKRO-capable keyboard device (up to 104 keypresses + modifiers)
2 8-button gamepad devices with 4-way digital directional pads

I've been working on this to allow me to use my SNES gamepads on the computer as either a set of gamepads, or as a keyboard. Certain emulators impose input lag when using DirectInput devices; so that is where the keyboard comes in. I successfully played several SNES games through Snes9x and it worked flawlessly.

The library can be found on my github (http://github.com/jjstreet/teensyarcade) profile.


Serial debugging has been removed. So don't expect the serial monitor to work.
The keyboard API is different than other board profiles because of the NKRO capabilities. See keycode.h for keyboard keys.
The joystick API has been removed. The gamepad API can be accessed through the Gamepad1 and Gamepad2 objects. See gamepad.h for button presses.

Finally, within my repo exists 2 example programs. One shows how to read the SNES gamepad protocol and translate button presses into keyboard presses. The other translates gamepads to HID gamepad devices. They also have pretty good de-bouncing capabilities.

Feed back is always welcome, and I'll update this post with some pics.

12-25-2014, 12:13 AM
Hi joshuass, thanks a lot for your effort on this.

I followed you code at github, and set the pins with my config and works fantastic!!!! with 2 pads, snes and also nes gamepads, or play individual or mixing snes and nes pads.

-I tried your keyboard sketch and works well with Windows and Ubuntu with my emulators. I've to try with a Android Tv Box if works with snes emulators, but I think that also works too as a simple keyboard.

-but If I load your Gamepad schetch runs in Windows Xp and Windows 7, (I tested under gamepad settings and I see 2 joystick axys and buttons movements) but not in Linux (tried in Ubuntu and Linux Mint)
it detects 2 joysticks as /dev/input/js0 and /dev/input/js1 but pad and buttons not works :( I tested with app jstest-gtk, and there wasn't outputs )
but I tried to load a simple scketch a with 1 joystick with Paul default settings UsbType (keyboard + Mouse + Joystick ) this detect my joystick and I can see the movings with the app and play emulators like Fusion (sms emulator).

I readed your code but I'm not a developer expert sorry, , I can't understant HID code compared with others, is complex for me :( ,
I think that is only a simple part to cover because it run in windows, and linux detect the device as gamepads. If you or other expert can take a tiem for try or other developer can follow your code it would be great that Linux could run your fantastic project.

happy Christmas

12-25-2014, 12:40 AM
sorry !!!! I don't know why but now it works perfect!!!! in linux sorry and apologize.

thanks for your project.

10-23-2015, 08:59 PM
Nice work here!. I just bought I new teensy 2.0 for this purpouse. My understanding on coding is very basic, I wish to ask you @joshuass how complex would be to translate this into de "libudev" (linux) for compatibility with steam (which only look at evdev API for joystick)?

Frank B
10-24-2015, 12:28 AM
hehe... a friend asked me to make a tetris-clone for teensy.
tetris is available for nearly all systems

so i decided to give it a try, but on Teensy 3. with original soundtrack (mp3/aac) stored in the teensy-flash (output pwm,dac, spdif, i2s..whatever you want) and ili9341 2.8'' touch display
flash is now - because of the soundfile - and fonts - 95% full, but the game is 80% done.

a really annoying thing is that we have no chance to use a framebuffer where you can _read_ pixel fast enough. the ram is too small.
i'm really waiting for the teensy3++... :-) it opens ways to do real arcade-games. with cheap displays.

a gamepad would be great.

11-13-2015, 12:48 AM
Just to update, this project is meant to be "only for snes controller" as far as I try, it doesn work as a "pin to gnd"; the only raw input it takes (for player 1) its "gnd -- D0" with the result of pressing all buttons. It's a pity cause it actually does everything I wanted, I mean, work with all new and old joystick driver in linux and it create two js files.

It is also hard to modify for a newbie cause a) The "Board type" (Keyboard + Joystick 'Arcade') has to many specs for snes controller and... b) it's writted in C (this is not that hard, to be honest).

If there's a way to programming to split into 2 devices like this project but in arduino software, that'll be awesome. Any help would be appreciated.

BTW: The project here only works with Arduino IDE 1.0.6 (not the new 1.6...)

01-13-2016, 06:24 PM
Last update: I found a solutión to create whatever number of virtual joystick in this project https://github.com/Vantskruv/wejoy. It's a little trickly to compile but works well using udev to that matter.