2016/06/14

How to use Unojoy with Arduino Uno

This is a quick summary of how to use Unojoy with Arduino Uno.

Preparing the necessary software

1. Download the code from here.

Pick "UnoJoyWin-21Feb2013.zip" as it's the latest version for MS-Windows.




2. Unzip the downloaded file into a folder. In the folder, the key files are in the 3 folders highlighted below.

Note,

In the ATmega8u2Code\HexFiles folder, there are "UnoJoy.hex" and "Arduino-usbserial-uno.hex". Burning the "UnoJoy.hex" into the Atmega16U2 of an Arduino Uno board will turn the board into a HID Joystick. Burning the "Arduino-usbserial-uno.hex" into the Atmega16U2 of the same board will turn in back to an Arduino Uno board.

The procedure for burning "UnoJoy.hex" and "Arduino-usbserial-uno.hex" into the Atmega16U2 of an Arduino Uno board can be found in my previous post here.

The sample Arduino sketch and its library are located under the UnoJoyArduinoSample folder.

The program for verifying the code developed to take advantage of Unojoy is located under the UnoJoyProcessingVisualizer folder.

Compile and upload the sample sketch

Compile and upload the "UnoJoyArduinoSample.ino" sketch in the UnoJoyArduinoSample folder to the Arduino Uno board.

Verify the sketch

Launch the "UnoJoyProcessingVisualizer.exe" program in the UnoJoyProcessingVisualizer folder. A window similar to the one below will appear.


Plug one end of a wire into the GND and the other end into digital pin 2 ~ 12 and analog pin A4 ~ A5 to see the corresponding button lights up in the window.


For the joystick portion, please refer to the article - Interfacing a Joystick.

After checking the sketch and seeing everything is working as planned. It's time to turn the Arduino Uno board into a joystick.

Flashing the "UnoJoy.hex" into the ATMega16U2 of the Arduino Uno board

Please refer to the "Burning the firmware into atmega16u2" section of my previous post for detail instruction.

After burning the "UnoJoy.hex" and unplug and plug the USB cable, there is now a new device called "HID-compliant game controller" in Windows Device Manager.


Note, To upload sketch to the Arduino Uno board again, burn the "Arduino-usbserial-uno.hex" into the atmega16u2.

Reference

unojoy - GettingStarted.wiki
https://code.google.com/archive/p/unojoy/wikis/GettingStarted.wiki

Arduino UnoJoy gamepad (Windows, XBox emulation)
https://www.youtube.com/watch?v=GrO8ZmxbOyI

Arduino wireless gamepad (UnoJoy)
https://www.youtube.com/watch?v=cZc-23NjNHY

Interfacing a Joystick
https://www.arduino.cc/en/Tutorial/JoyStick

No comments:

Post a Comment