Hi evryone,
I am trying to tipe keys with my arduino leonardo using the lubrary Keyboard.h,
It all works great except for the ENTER key.
I tried in all ways possible but it still doesent work.
Here are the attempts that didn't work:
Keyboard.println("ls -al");
Keyboard.println();
Keyboard.write(176);
Keyboard.write(13);
Keyboard.write(RETURN);
Keyboard.write(ENTER);
Keyboard.write(KEY_RETURN);
Keyboard.write(KEY_ENTER);
I also tried all of .write with .press but still not working.
What i I doing worng?
Thank you for helping!
amenofi_iv:
Keyboard.write(13);
13 (0x0D, Return) doesn't translate but 10 (0x0A, Linefeed) translates to keycode 0x28 (40).
I don't know where RETURN, ENTER or KEY_ENTER get defined or what their values are.
KEY_RETURN is defined in Keyboard.h as 0xB0 (176)
That gets translated to Keycode 40 (0x28)
Versions that should work are:
Keyboard.println("ls -al");
Keyboard.print("ls -al\n");
Keyboard.print("ls -al");
Keyboard.write(KEY_RETURN);
Keyboard.print("ls -al");
Keyboard.write(10);
Keyboard.print("ls -al");
Keyboard.write(10);
Should I use them toghether?
Thanks for helping.
system
Closed
August 30, 2023, 3:45pm
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.