I put together a NES controller connected to a Arduino mini pro (3.3v) and a Bluetooth HID module (similar to the rn-42 BlueSmirf). I can get it connected to my Macbook and it sends keystrokes.
However, it acts like the key is being repeatedly pressed instead of a key being held down. I need it to act exactly like a keyboard, but right now it presses a key every time it goes through the loop (50ms). Thanks for the help in advance!
Arduino Code:
const int buttonA = 2;//Button: A
const int buttonB = 3;//Button: B
const int buttonC = 4;//Button: Start
const int buttonD = 5;//Button: Select
const int buttonE = 6;//Button: Up
const int buttonF = 7;//Button: Down
const int buttonG = 8;//Button: Left
const int buttonH = 9;//Button: Right
...
void loop()
{
if (digitalRead(buttonA) == LOW) //pin is HIGH until a button is pressed
{Serial.write('A');}
if (digitalRead(buttonB) == LOW)
{Serial.write('B');}
if (digitalRead(buttonC) == LOW)
{Serial.write('1');}
if (digitalRead(buttonD) == LOW)
{Serial.write('2');}
if (digitalRead(buttonE) == LOW)
{Serial.write('U');}
if (digitalRead(buttonF) == LOW)
{Serial.write('D');}
if (digitalRead(buttonG) == LOW)
{Serial.write('L');}
if (digitalRead(buttonH) == LOW)
{Serial.write('R');}
delay(50);
}