Triggering line feed using the keyboard modifiers

The 9000 limit is infuriating sometimes >:( #just lost the whole post

I have a routine that emulates a keyboard. All works fine, but the line feed and enter functions were removed/not used in the demo code I lifted off Google many moons ago (can't find it now).

When I press Enter on my attached keyboard, it reports 10 followed by 13. That is line feed, followed by enter.

The command for trigger enter I believe is:

Keyboard.press(KEY_ENTER); Keyboard.release(KEY_ENTER);

But I cannot find the one for line feed (if there is one).
Any ideas?

This is a code snippet... I lost the post when I tried posting the whole routine.
When you press Enter on the keyboard, it does jump to case 235 (Line feed) and case 238 (Enter).

case 231:                                                                    // Control F
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_F);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

    case 232:                                                                    // Control G
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_G);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

    case 233:                                                                    // Backspace
      Keyboard.press(KEY_BACKSPACE); Keyboard.release(KEY_BACKSPACE);
      break;

    case 234:                                                                    // Tab
      Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB);

      break;

    case 235:                                                                    // Line feed            Originally disabled
       //Keyboard.press(?); Keyboard.release(?);

      break;

    case 236:                                                                    // Control K
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_K);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

    case 237:                                                                    // Control L
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_L);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

    case 238:                                                                    // Carriage return          Originally disabled
      Keyboard.press(KEY_ENTER); Keyboard.release(KEY_ENTER);

      break;

    case 239:                                                                    // Control N
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_N);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

    case 240:                                                                    // Control O
      Keyboard.set_modifier(MODIFIERKEY_CTRL);
      Keyboard.send_now();
      Keyboard.set_key1(KEY_O);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();
      break;

13 is known as CR (Carriage Return)
10 is known as LF (Line Feed)

have you tried sending Keyboard.println(); // https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardprintln/

The Keyboard library defines KEY_RETURN for the Return/Enter key.

Usually, the keyboard only sends the Return/Enter key code and it is up to the operating system to decide if that means CR, LF, or CRLF.

To type an explicit CR or LF you should use:

  Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('m'); Keyboard.releaseAll(); // CR=Ctrl-M
  Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('j'); Keyboard.releaseAll(); // LF=Ctrl-J

Rather than using "Keybord.press()" followed immediately be "Keyboard.release()" you can use "Keybord.write()" which does both.

Note: When you .print() or .write() the Linefeed character (ASCII 10 or 0x0A) to Keyboard it maps to the Return/Enter key. The Carriage Return character (ASCII 13 or 0x0D) maps to zero (no mapping).

Many thanks. That appears to work.