My goal is simple: Four buttons to control the minimalist fighting game Divekick. It's pretty easy code wise, and I've written the following code:
int onedive = 5;
int onekick = 4;
int twodive = 3;
int twokick = 2;
int od = 97;
int ok = 98;
int td = 99;
int tk = 100;
void setup() {
Keyboard.begin();
pinMode(onedive, INPUT);
pinMode(onekick, INPUT);
pinMode(twodive, INPUT);
pinMode(twokick, INPUT);
}
void loop() {
if (digitalRead(onedive) == 0)
{
Keyboard.press(od);
}
else
{
Keyboard.release(od);
}
if (digitalRead(onekick) == 0)
{
Keyboard.press(ok);
}
else
{
Keyboard.release(ok);
}
if (digitalRead(twodive) == 0)
{
Keyboard.press(td);
}
else
{
Keyboard.release(td);
}
if (digitalRead(twokick) == 0)
{
Keyboard.press(tk);
}
else
{
Keyboard.release(tk);
}
}
It simply finds the states of four buttons (pull-up) and writes that state to either the a, b, c, or d key on the keyboard.
However, only the Leonardo supports the Keyboard library! I've found information saying that it is possible to use this function on the UNO, but it requires updating the firmware of the USB interface chip. The sources I found also mentioned that a resistor may need to be soldered to the UNO, but they all showed either r1 or r2. I have the DIP r3.
Basically, the information on this seems dated, and I feel daunted. How can I get my UNO to emulate a keyboard with the keyboard library without screwing it up?
Yes, I've heard about VUSB. It's even optimal, as I could implement it on an ATtiny. However, I don't have the diodes yet, and I was hoping to use the usb port on the UNO. So, I guess a clarification is in order:
What is the detailed process of getting the UNO R3 DIP (non-SMD) to send commands directly to a windows computer that a game could interpret as input, with no computer-side code? (While I was hoping to use Keyboard.press and Keyboard.release, the ability to emulate a gamepad would be welcome.)
While I'm still looking for a way to use the UNO usb port, I'm trying to use vusb. Hardware side, I don't have any zeners or regulators of the right value for the data pins. Can't I just use a couple transistors as switches, and the Arduino 3.3 volt header as the base?
Is anyone still here? Rancidbacon site isn't working, and i have no clue what designs it is compatible with. If you know a way to view the actual code for reading/sending keystrokes over wires for usb LIKE a 32u4 or SAMD micro based board using the normal functions, that would be absolutely amazing.