Question

I am working on a paper keyboard using barepaint and arduino leonardo. Every key works fine so far, except the return key.

This is how the code looks for one button:

if (button5 > 1000)
  {
    Keyboard.write(120);
  }

But I can't seem to find the ASCII value for the key, return. I know it's some sort of a combination, but I can't make it work.

Was it helpful?

Solution

The Arduino documation for the Keyboard library lists 176 as mapping to `KEY_ENTER'.

The source code maps ASCII 10 to ENTER and does not map ASCII 13 to anything.

Internally both 176 and 10 map to the USB HID keyboard value 40 (decimal).

According to http://www.usb.org/developers/devclass_docs/Hut1_11.pdf‎ 40 maps to "Keyboard Enter" (as opposed to "Keypad Enter")

So use either 176 or 10 they should do the same thing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top