I have a Teensy set up as a keyboard, joystick, and I'm giving keyboard commands. Letter and number keys are going fine. But when I try sending ENTER, I get some extra code in my Linux terminal:

$ 16424
16424: command not found

the code I have to give the ENTER key goes like this:

void setup() {
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);

void loop() {
  // read the digital inputs and set the buttons
  Joystick.button(1, digitalRead(0));

where is this "16424" coming from, and how do I send an ENTER keypress? I am using a Teensy 2.0, on Linux, with Arduino IDE 1.6.7.

  • Keyboard.println((char) KEY_ENTER); might be the problem? Apr 15 '16 at 7:11

You can't just "print" a key like that. You use print for sending text.

When you use println it sends an enter key along with your text, so you can do :

Keyboard.println("ls -al");

and it will send the text ls -al and press enter for you.

If you want to do it in the 'raw' way you will need to press and then release the key:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.