Hallo zusammen,
Ich möchte eine Art Handheld bauen indem ich einen Raspberry pi mit einem arduino Micro verbinde. Leider habe ich noch nie einen arduino als Controller genutzt. Ich würde gerne den Controller wie einen ps 2 Controller machen, sprich zwei Joysticks und 14 Taster. Mein Haupt Problem sind die Joysticks wie kann ich diese Programmieren?
Ich kriege einen auf serial Monitor angezeigt also das sich meine Potentiometer im Joystick verändern mehr aber auch nicht.
Hello, everyone,
I want to build some kind of handheld by connecting a raspberry pi to an arduino micro. Unfortunately, I've never used an arduino as a controller. I would like to make the controller like a ps 2 controller, i.e. two joysticks and 14 buttons. My main problem are the joysticks how can I program them?
I get one displayed on the serial monitor, so that my potentiometers in the joystick change but nothing more.
Try the Arduino XInput library. This library can create an XBox 360 gamepad (also known as XInput gamepad). It does not work on an XBox 360 console because of copy protection and DRM but works on Windows, MacOS, Linux, etc.
If it must be PS2 compatible, you will have to write the code yourself.
One of the examples included with library shows how to poll 2 joysticks/thumbsticks and a bunch of buttons.
Use Chrome/Chromium or Firefox browser to connect to this web site. Joysticks and gamepads can be used from Javascript running in a browser for web based games.
If using Debian/Ubuntu/Raspberry Pi OS, there is a GUI joystick testing tool.
I tried it but it doesn't seem to recognize the arduino micro as a controller at all.
i closed the buttons on the pins in the program, as well as the joysticks. I closed the buttons from the pin via the button to ground (i.e. as an example d2->button->ground) is there something wrong with the program or with the way I connect the buttons?
I suggest removing all wires and connections to the Arduino Micro board except the USB connection. Set board type to "Arduino Micro w/ XInput". Upload the GamepadPins.ino example. Open a browser to https://gamepad-tester.com. The web page says to press one of the buttons on the controller. Connect a wire to ground then connect the other end to D2. This is the equivalent to pressing and holding down button 2. The Arduino board should show up an XBox 360/XInput gamepad with B2=1.00. If not, I suggest re-reading the XInput library instructions and tutorials.