
Anyway, I opted to use the Leonardo Micro instead of a teensy, pretty much same size.
http://www.ebay.co.uk/itm/201310315804
I wanted to share my arduino code that I used. I've used this same code on a Retro Arcade Machine Coffee Table I built
Code: Select all
#include <Keyboard.h>
#define BUTTONS 15
int pin_arr[]={2,4,3,5,14,16,9,8,A0,A1,6,7,A2,A3,15};
int keycode_arr[]={218,217,216,215,128,130,32,129,122,176,53,49,112,177,179};
// UP,DOWN,LEFT,RIGHT,LEFT-CTRL (Button 1), LEFT-ALT (Button 2),SPACEBAR (Button 3), LEFT-SHIFT (Button 4), Z (Button 5), ENTER (Button 6) (Enter instead of X so can use with other RPi things like raspi-config), Coin/Credit, 1P Start, P (Pause), ESC, TAB
int key_state[BUTTONS];
void setup() {
Keyboard.begin();
for (int i=0;i<BUTTONS;i++)
{
pinMode(pin_arr[i], INPUT_PULLUP);
key_state[i] = digitalRead(pin_arr[i]);
}
}
void loop() {
for (int i=0;i<BUTTONS;i++)
{
key_state[i]=digitalRead(pin_arr[i]);
if (key_state[i]==LOW) {
Keyboard.press(keycode_arr[i]); if (keycode_arr[i] == 49) { delay(100); }
} else {
Keyboard.release(keycode_arr[i]);
}
}
}
https://www.dropbox.com/s/hvwi92295z8qs ... o.zip?dl=1
the download also includes an additional header (not included in the compilation as it's for reference only) That lists all the Key Codes.
I hope this is of use to others