Created with Teensy LC works perfect apart from 3 button press simulates start
using all emulators this happens ,
the project
I added a micro switch to the back of the pad to use as select
Change pin numbers as needed
// player 1 bank
const int P1_A = 4;
const int P1_B = 5;
const int P1_C = 6;
const int P1_LEFT = 2;
const int P1_RIGHT = 1;
const int P1_DOWN = 9;
const int P1_UP = 8;
const int P1_SELECT = 10;
const int START_BUTTON = 7;
unsigned long lastTime = 0;
void setup()
{
pinMode(P1_A, INPUT_PULLUP);
pinMode(P1_B, INPUT_PULLUP);
pinMode(P1_C, INPUT_PULLUP);
pinMode(P1_LEFT, INPUT_PULLUP);
pinMode(P1_RIGHT, INPUT_PULLUP);
pinMode(P1_DOWN, INPUT_PULLUP);
pinMode(P1_UP, INPUT_PULLUP);
pinMode(START_BUTTON, INPUT_PULLUP);
pinMode(P1_SELECT, INPUT_PULLUP);
lastTime = millis();
}
void loop()
{
unsigned long time = millis();
// run at 50 Hz
if(time - lastTime >= 20)
{
lastTime = time;
// read the data of all our buttons
// our buttons
Joystick.button(1, 1 - digitalRead(P1_A));
Joystick.button(2, 1 - digitalRead(P1_B));
Joystick.button(3, 1 - digitalRead(P1_C));
Joystick.button(4, 1 - digitalRead(START_BUTTON));
Joystick.button(9, 1 - digitalRead(P1_SELECT ));
// also use buttons for the axes cuz unity is a derp
Joystick.button(5, 1 - digitalRead(P1_UP));
Joystick.button(6, 1 - digitalRead(P1_RIGHT));
Joystick.button(7, 1 - digitalRead(P1_DOWN));
Joystick.button(8, 1 - digitalRead(P1_LEFT));
}
}