In this instructable I will show you how to build/program an arduino game controller which can connect to unity.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What You Will Need!
- 1 Arduino Uno
- 1 Breadboard (unless you solder immediatly)
- 16 Electrical wires
- 3 Button (not necessarely needed for this game, but is included in the code)
- 1 Pressure sensor (can be a button too, but has less possibilities as a button)
- 1 Rotary sensor
- 1 Temperature sensor (won't be necessarly needed for this game, but is included in the code)
- 4 100 Ohm resistors (red, blue, brown and gold)
Step 2: Placing All the Wires
Place all the wires as in the picture above.
This is just the basic parallel structure of each button and sensor (if you have other kinds of buttons you can just look up the basic setup)
Step 3: Programming the Arduino
For this we use the program Arduino, which you can download at their website
Now download the Arduino_controller file and open it.
Here you can see how the code works and implement it into your own Arduino by hitting upload at the upperleft corner.
Step 4: Make/download the Game
You can download the game I made which has the inputs linked to it.
You can look into the code to see how I track the Serial monitor to get the inputs.
If you can't find it I'll explain in short what I did:
1. I downloaded the Ardity asset from the asset store and read the manuel
2. I then made made object containing the track script made by Ardity
3. To the retrieve the information from the script to a movement script which uses the information to move etc.
Step 5: You Can Now Run the Game
Run the game and use the buttons to move through the menu.
(I did however change the input so my pressure button is also the select button instead of Button 2)