Hi all,
I know that it is possible to use arduino in order to send commands on computer or use it as keyboard or mouse. Also how can I open cmd on windows with arduino? Is there any function?
Thanks.
Use the Keyboard library to do this:
- Windows key + R. Windows key is KEY_RIGHT_GUI in the Keyboard library.
- type cmd
- Enter
If you want something that is less fragile, but requires some set up on the target computer, you can to this:
- Create a shortcut to cmd.exe
- Right click on the shortcut.
- Click "Properties".
- Click on the "Shortcut key" field.
- Press the keyboard shortcut you want to use to open the shortcut. Make sure this is a unique keyboard shortcut. Since you're not going to be typing it manually in normal use, you can use something elaborate like ctrl + alt + shift + ,
- Click the "OK" button.
- Program the Arduino to type the keyboard shortcut you associated with the shortcut.
Keyboard library documentation:
Note that you can only use the Keyboard and Mouse libraries on certain Arduino boards (e.g., Leonardo, Micro, Pro Micro, MKR boards, Nano 33 IoT). You can't use it with the Uno, Mega, Nano, or Pro Mini.