My intention is to set up the Arduino Leonardo as a USB keyboard so that by pressing a single button I can simulate a certain Keyboard Key press to a KVM device. I’m trying to simulate an Up Arrow Key press.
My code is below, and works perfectly fine and as expected when the Arduino is connected to a Windows computer but when I connect the Arduino to the KVM device via USB the Up Arrow Key is not simulated.
When I connect any other purpose built USB Keyboard to the KVM it works just fine Hence I have come to the realisation that it could quite possibly be a compatibility issue between the Arduino when used as a USB Keyboard and the KVM.
I think I need to edit something in one of the Arduino libraries and maybe even in my code but I am a total novice and am totally lost. Can anybody help please?? MUCH APPRECIATED!!!
int buttonPin = 2;
if (digitalRead(buttonPin) == 0)