using librairy usbkeyboard for a NES project

Hi,

I almost finish a project where I convert the NES remote protocol with an arduino standalone and i send the information via usbkeyboard, so i don’t need any other component (using this schematic http://www.practicalarduino.com/projects/virtual-usb-keyboard).

Everything work… when i press a button on my NES remote, the data is send like if it was a keyboard and i get some letters on my computer.

My problem is to understand how the protocol of a keyboard is working : when you are on a normal keyboard and you keep a button press, it seem to wait half a second after writing the first character and then write the characters very fast. On a emulator, pressing the key jump for a while is gonna make you jump higher, but if you press jump several short time it s just gonna make few small jump.

With usbkeyboard library, i don’t understand how you can simulate a real keyboard with a key pressed for a while… so when i play, i can only make small jump… that’s quiet bad to play :s

If anyone has a website about this, i can’t find any answer on google. I will publish the project when this is fix if some people want to play with this as well :slight_smile:

it seem that it’s call the “repeat delay” (time between the first character and the others going fast) and “repeat rate” (how fast the other characters repeat).

I am trying to make one on code inspire by this sparkfun tuto Turn your ProMicro into a USB Keyboard/Mouse - SparkFun Electronics
Just after wrting the first character i do :

outputTemp=outputP1;
while(outputP1==outputTemp){
ReadNES();
}

void ReadNES() { //the NES protocole, modify outputP1
latchlow;
clocklow;
latchhigh;
wait;
latchlow;
outputP1 += dataP1read * (1 << 0);
for (int i = 1; i < 8; i++) {
clockhigh;
wait;
outputP1 += dataP1read * (1 << i);
clocklow;
wait;
}
}

but it doesn’t work yet :s, even if i keep the button press… he doesn’t stay inside the while