gamelaster / ArduinoGamepad

A GamePad HID library for Arduino Pro Micro/Leonardo (ATMega32u4)
86 stars 20 forks source link

Gamepad unrecognised by mac OS catalina #3

Open OpenZSD opened 4 years ago

OpenZSD commented 4 years ago

Programmed my arduino Leonardo on my Linux machine and it works as a gamepad, however it doesn't recognize on my Mac.

gamelaster commented 4 years ago

Any more information please?

OpenZSD commented 4 years ago

The program I tested it with is step mania (it has a test input screen). I made sure to plug in the controller before starting step mania. The OS version is Catalina.

As for the sketch its:

include

//#include

int UP_AR = A0; int DOWN_AR = A1; int LEFT_AR = A2; int RIGHT_AR = A3; int YES_K = A4; int NO_K = A5; int START_K = 2; int EXIT_K = 3;

int UP_LED = 8; int DOWN_LED = 9; int LEFT_LED = 10; int RIGHT_LED = 11; int YES_LED = 12; int NO_LED = 13;

struct KeySet { int pin; int LEDpin; bool isAnalog; int key; };

Gamepad gp; KeySet KEY_LIST[8];

void setup() {
//W0,W1 GND //W2-9 TBD

KEY_LIST[0] = {UP_AR,UP_LED,true,0}; //W14 KEY_LIST[1] = {DOWN_AR,DOWN_LED,true,1}; //W12 KEY_LIST[2] = {LEFT_AR,LEFT_LED,true,2}; //W10 KEY_LIST[3] = {RIGHT_AR,RIGHT_LED,true,3}; //W15 KEY_LIST[4] = {YES_K,YES_LED,true,4}; //W13 KEY_LIST[5] = {NO_K,NO_LED,true,5}; //W11 KEY_LIST[6] = {START_K,-1,false, 6}; KEY_LIST[7] = {EXIT_K,-1,false, 7};

pinMode(START_K, INPUT); pinMode(EXIT_K, INPUT); digitalWrite(START_K, HIGH); digitalWrite(EXIT_K, HIGH);

pinMode(UP_LED, OUTPUT); pinMode(DOWN_LED, OUTPUT); pinMode(LEFT_LED, OUTPUT); pinMode(RIGHT_LED, OUTPUT); pinMode(YES_LED, OUTPUT); pinMode(NO_LED, OUTPUT);

// Keyboard.begin(); }

void updateKP(bool pressed, int idx) { gp.setButtonState(KEY_LIST[idx].key, pressed); if(KEY_LIST[idx].LEDpin > 0) { digitalWrite(KEY_LIST[idx].LEDpin, pressed ? HIGH : LOW); } }

void loop() { for(int i = 0; i < 8; i++) { bool pressed = KEY_LIST[i].isAnalog ? (analogRead(KEY_LIST[i].pin) < 100) : (digitalRead(KEY_LIST[i].pin) == LOW); updateKP(pressed, i); delayMicroseconds(200); } }