Issue with Keyboard Input

Hello,

I'm trying to explore how effective an arduino leonardo would be as a control input for flight simulator using key presses however I have a strange issue. When I open notepad and trigger the key to be pressed by spinning an encoder the keypresses if I spin the encoder very slowly all the correct key presses appear, however if I spin the encoder quickly, they just get ignored and only one or two key presses appear despite spinning the encoder 20 times. For any turns on the encoder there is a 100ms delay or so which isn't really good enough for my use

However, if I open the serial monitor in arduino while doing the exact same thing every turn is picked up and a the text is printed out very quickly in real time as expected.

Why does this only seem to happen when the serial monitor is open? How can I improve the responsiveness of the key presses without having to keep serial monitor open?

In the program there is only one delay of 1ms, which isnt causing the issue.

Any help would be much appreciated!
Thanks

Oh actually I think I have fixed this myself! I was previously using

Keyboard.write('u');

but if I change it to

Keyboard.press('u');
delay(1);
Keyboard.release('u');

That seems to work better :slight_smile: