I'm doing a project in arduino leonardo where I use it as a joystick, but I can not make the game recognize and execute the commands read how can I do it ??
My computer recognizes the arduino leonardo as a joystick, but when I start the game it does not respond to the command I exercise on the joystick ...
#include <Joystick.h>
int joystick1 = 0;
int eixoX1 = A0;
int eixoY1 = A1;
int pinA2 = false;
int pinA3 = false;
int pinA4 = false;
int pinA5 = false;
void setup(){
Joystick.begin();
}
void loop(){
int eixoX1 = analogRead(A0);
int eixoY1 = analogRead(A1);
eixoX1 = map(eixoX1, 0, 1023, -127, 127);
eixoY1 = map(eixoY1, 0, 1023, -127, 127);
Joystick.setXAxis(eixoX1);
Joystick.setYAxis(eixoY1);
}
when I start the game it does not respond to the command I exercise on the joystick ...
Does the game actually support the use of a joystick ? If so, then do you need to configure it to accept joystick input as opposed to say mouse or keyboard input ?
Yes the game "DIG IT" supports joystick, keyboard and mouse input
In keyboard and mouse works well, with another programming I did, but in joystick it does not work
In keyboard and mouse works well
That's because the Leonardo can emulate a mouse and a keyboard. Why did you then assume that it can emulate a joystick?
Where did you get the Joystick library you are using? What does it do?