Using the solid core wire/jumper wire, connect the Vout pin of each muscle sensor to the analog pins on your Arduino.
Sensor 1 Vout --> Analog pin 0
Sensor 2 Vout --> Analog pin 1
Sensor 3 Vout --> Analog pin 2
Sensor 4 Vout --> Analog pin 3
Then connect the GND pin of muscle sensor 1 to the GND pin on your Arduino and the GND pin of muscle sensor 2 to the Analog pin 3 of your Arduino. That last part will keep the remaining two analog pins from floating along with your sensor 4's output.
By this point, your USB Biofeedback Game Controller should be completely assembled and hooked up. Before we go any further, we'll need to test out your muscle sensors to make sure everything is setup properly.
To test your setup, we're going to use the same visualization software as we used in our muscle sensor demo video. If you haven't already, download and install both the Arduino and Processing software.
Next, download the BarGraph example code on our GitHub repository. Open the Arduino sketch and upload it to your UNO. If you're new to Arduino, check out the information on Arduino's website to help you on this step. Once uploaded, plug in the wall adapter to the barrel jack to power up your muscle sensors.
Next, open the Processing sketch and hit the Run button in the top left. Another window will pop up with 6 colored bars on it. Flex your right forearm, left forearm, right bicep, and left bicep and watch the bars move accordingly. If while at rest, your sensors value is below or above 150 then adjust the gain of your sensor using a screwdriver and turning the poteniometer on the corresponding sensor so that they are around 150 at rest.
As you flex each muscle, the bars should move past the 300 mark. This is important since the software to follow uses the 300 mark to trigger a "button press". You can adjust the gain of your sensor and this threshold level in the code to fine tune your desired button press sensitivity.
Once everything appears to be in working order, close out Processing and you're ready to hack your Arduino into a keyboard.
Now, we'll work on turning your Arduino UNO into a HID keyboard.
First, Download the Arduino sketech from our GitHub repository, then compile and upload the sketch to your Arduino.
This is the code that, if desired, you would modify the threshold value in to adjust the "button" sensitivity.
To play video games on your computer with the Arduino, we're going to turn your Arduino into a HID USB keyboard to interface with your computer; to do this you'll need to upload new firmware.
Note: You'll need to reflash your Arduino with the original firmware to upload new sketches again
Once your Arduino can be connected to your computer and recognized as a HID device, it should be ready to go. Disconnect it and slide it down into your project enclosure.