I am using an arduino pro micro for my controller in the handheld console, my computer for the console is a Raspberry pi 4b.
I have an arduino controller that I will use in the handheld, which has 14 buttons and 2 joysticks, which I got to work perfectly fine with my windows pc.
When I connected it to my rpi and when to the retropie configuration settings, the buttons configured perfectly, but the joysticks did not. Again they work fine on my pc but don't work at all on my rpi4.
I have the joysticks range set to this:
xAxisValue1 = map(xAxisValue1, 0, 1023, 0, 255);
yAxisValue1 = map(yAxisValue1, 0, 1023, 0, 255);
xAxisValue2 = map(xAxisValue2, 0, 1023, 0, 255);
yAxisValue2 = map(yAxisValue2, 0, 1023, 0, 255);
I want to mention when I change the (0, 255) to (-32767, 32767) the joysticks start bugging, where the x axis gets maxed out, and just refuses to work properly. I tried to us jscal which is after I changed the range back to (0, 255), which gave me this information:
when centered:
Axes: 0: -27723 1: -32767 2: -27039 3: -27296
when moved left for both joysticks:
Axes: 0: - 32767 1: -32767 2: -32767 3: -27296
when I move right for both joysticks:
Axes: 0: -16449 1: -32767 2: -16449 3: -27296
when I move up for both joysticks:
Axes: 0: -27723 1: -32763 2: -27039 3: -32767
when I move down for both joysticks:
Axes: 0: -27723 1: -27296 2: -27039 3: -16449
Mapping the joysticks in the retro pie configuration produces no results, as it just goes to "not defined" as if I skipped the mapping.
My guess is that I need to set the range, but when I set it to (-32767, 32767) the joystick glitches out on even my laptop as well.
I used a serial monitoring code, and found that my maximum joystick values are 0 and 1023 for both axis and joysticks, which is the limit for an arduino.
I also want to mention, before calibrating my joysticks on windows, the joysticks even when moving the joysticks to the maximum and minimum, the app "setting up a usb gamepad" it shows that it only takes up half of the box even when rotating the joysticks fully, after calibration there is a full range of motion for both joysticks, so that might be a clue. I have spent hours of my weekends trying to resolve the issue and modifying the code, but I just don't have the knowledge to figure it out.
TLDR; I have joysticks connected to my arduino for a custom gamepad for a handheld console, it works on my windows pc, but doesn't on my raspberry pi.