I have an Arduino Uno connected to my laptop and I need to get keypress info from the laptop's keyboard with only the Arduino sketch and without any program running on the laptop. Is there a specific library or some way of doing so?
-
As you wrote your question: No, you can't do this. How could a sketch running on the Arduino make the computer transfer keyboard input, if there is no program for this running on the computer?the busybee– the busybee2019-12-03 07:19:26 +00:00Commented Dec 3, 2019 at 7:19
-
I read this question and commented it earlier today. Did you delete it and ask again with the "no program" addition?Juraj– Juraj ♦2019-12-03 08:20:57 +00:00Commented Dec 3, 2019 at 8:20
-
@Juraj, you are correct in your thinking ... i have also seen this same question earlier ... i commented about using Processing ... now the OP apparently wants to use a keyboard on a laptop that is shut down ... loljsotola– jsotola2019-12-03 08:31:06 +00:00Commented Dec 3, 2019 at 8:31
-
@asaf, perhaps you could use a PS2 keyboard that is directly connected to the arduinojsotola– jsotola2019-12-03 08:33:08 +00:00Commented Dec 3, 2019 at 8:33
-
@Juraj it has been edited by an 'anonymous user'.Michel Keijzers– Michel Keijzers2019-12-03 09:25:10 +00:00Commented Dec 3, 2019 at 9:25
1 Answer
You can't. It's impossible.
Or not as you have requested it, anyway.
The Arduino can only talk over Serial, so you will have to have some software running on the PC that transfers data (however that data is generated) over serial to the Arduino to process.
The only other option will be to have one of the Arduino boards that is capable of acting as a USB Keyboard device, such as a Leonardo, plus either a PS/2 keyboard or a USB keyboard plus a USB Host shield. Your Arduino the receives the keystrokes from the keyboard, processes them, and sends the result on to the PC.