Keyboard Commands with Arduino Uno

I have an Arduino Uno and I am trying to send keyboard commands to the computer after a pushbutton is activated. Every time I try to use:

char DispatchKey = KEY_ENTER;

along with...

Keyboard.press(DispatchKey);

later on the code I get a couple of error messages when I try to verify it such as: "'KEY_ENTER' was not declared in this scope."

I'm not really sure what I am doing wrong. I'm pretty much following this example: Keyboard.press() - Arduino Reference just using the enter key instead of the left control key.

That particular page probably needs a note added.

If you read the home page for Keyboard (Keyboard - Arduino Reference) you'll see that Keyboard is only available on the Leonardo.

It is not compatible with the Uno.

1 Like

Is there anything else I can use to turn button pushes into keyboard commands?

Depending on what the keyboard commands should be used for, you could use Gobetwino

USB connectivity is handled by the ATmega8u2 or ATmega16u2 (depending on which version) on the Uno. You can reprogram this chip to act as a HID Device (USB term for Keyboard or Mouse). However, you lose the USB-to-serial functionality when you do that.

There are some projects which attempt to make a HID device with the ATmega328, but they generally do not work very well since they are not true differential signaling.

Gobetwino, if you are on Windows, may be the most straightforward method.