Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
14 votes

Arduino nano as HID Keyboard

Get yourself a Arduino Leonardo, Micro or Pro Micro (or Due, Zero, M0). Those can emulate a keyboard. Start with reading the Arduino Keyboard Mouse reference. The Arduino Nano can not use the Arduino ...
Jot's user avatar
  • 3,246
6 votes

Press the Windows key using "keyboard.press();"

They Keyboard.press() command accept modifiers per the documentation. You may need to do multiple press() commands before releasing. For example, if you want to launch File Explorer you could use: ...
Eric G's user avatar
  • 161
6 votes

Arduino Leonardo as keyboard for an iPad

If indeed the descriptor is the problem then yes you can change it. In the core file USBCore.h is the line: #define D_CONFIG(_totalLength,_interfaces) \ { 9, 2, _totalLength,_interfaces, 1, 0, ...
Majenko's user avatar
  • 105k
5 votes

How to convert USB to PS/2?

Many USB keyboards (certainly older ones, though almost certainly not wireless ones) are also PS/2 keyboards. The wiring of the cable is all that differs, and the chip in the keyboard changes its ...
Majenko's user avatar
  • 105k
4 votes
Accepted

How do I give the ENTER keypress?

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 ...
Majenko's user avatar
  • 105k
4 votes

How to add extra USB port to Arduino Nano?

USB is deceptively simple. The underlying protocol is very complex. So a complete answer to your question requires some USB background. USB is divided into 2 types. USB Hosts and USB Devices. We ...
st2000's user avatar
  • 7,340
4 votes
Accepted

Typing into ESP8266 with a USB keyboard

My 2002-era Mac keyboard doesn't work, That doesn't surprise me - modern Macs have never needed PS/2 support. none of my 5 wireless keyboards work, That's because they're not keyboards, they're ...
Majenko's user avatar
  • 105k
4 votes
Accepted

Keyboard.h not found

If you have Arduino/Genuino Uno selected as your board in the Tools ► Board ► menu, then you get the error. If you select Arduino Leonardo it compiles correctly. From Can't seem to be able use ...
Greenonline's user avatar
  • 2,982
4 votes

ESP8266: #include <Keyboard.h> causes fatal error: HID.h: No such file or directory

The Keyboard library is for Arduino ATMega32U4 based Arduinos (and other similar ones with USB) only. The ESP8266 does not have USB, so how can it possibly use the Keyboard library?
Majenko's user avatar
  • 105k
4 votes
Accepted

How to cut down size of imported DigiKeyboard library

With input from @EdgarBonet, I looked into the functions used and it turned out that the String() function, I used once in my code, takes up about 3kB of space in the compiled program. I ended up ...
emma.makes's user avatar
4 votes
Accepted

Mouse.move: how do I move the mouse to the center of a screen?

There are two ways of working with HID mice - absolute and relative. The Arduino Mouse library only works in relative mode, but you want absolute. There's another library https://github.com/NicoHood/...
Majenko's user avatar
  • 105k
3 votes
Accepted

Grab keys from an ordinary USB keyboard

As suggested in the comments, you have two options: As suggested by Majenko, you can use the Arduino USB Host Shield: Alternatively you could use a PS2 keyboard instead (as suggested by Gerben). ...
sa_leinad's user avatar
  • 3,188
3 votes
Accepted

Can I make so when I press a button on my Arduino Uno board, it will press a key on my computer?

Not without extra software on your computer side. However if you use Arduino Micro, you can emulate keyboard and/or mouse directly.
KIIV's user avatar
  • 4,752
3 votes

Press the Windows key using "keyboard.press();"

Looking at the list of the HID keyboard codes (page 53), the keys you are looking for have a code of E3 (Keyboard Left GUI) or E7 (Keyboard Right GUI). Unluckily the Keyboard::press function (you can ...
frarugi87's user avatar
  • 2,721
3 votes

Send Keyboard Media Keys with Keyboard Library

It is indeed possible and also without the requirement to modify the Arduino environment itself. Just register an HID descriptor for the "report ID" for "Consumer Control" (the ...
Peter Mortensen's user avatar
3 votes

Arduino nano as HID Keyboard

The solution to get a board that has built in USB support is not preferred for someone who just wants to use the boards they already have. It is possible to use a board that can communicate with your ...
nicholas's user avatar
  • 131
3 votes
Accepted

Arduino Micro draws too much power from iPhone. How can I change that?

The power consumption is part of the exchange with the PC when it is plugged in. You can change that. Find the file USBCore.h in your Arduino install directory. In my case (under Linux) it was: ./...
Nick Gammon's user avatar
  • 38.3k
3 votes

Emit region-neutral keyboard signals

No. There is no such facility. If you take a German keyboard and plug it into a US configured computer the key layout will be wrong. You have to tell the computer that you're using a German keyboard. ...
Majenko's user avatar
  • 105k
3 votes

Emit region-neutral keyboard signals

Download Device Class Definition for Human Interface Devices (HID) https://www.usb.org/sites/default/files/documents/hid1_11.pdf See section 6.2.1 HID Descriptor bCountryCode 0x09 German also see ...
jsotola's user avatar
  • 1,515
3 votes
Accepted

STM32 as keyboard

The STM32F105xx series is not yet supported by either Arduino core (STM32 core or maple core) and neither mbed-os. The chip is still usable with the STM32 provided framework, the STM32HAL, (e.g. ...
Maximilian Gerhardt's user avatar
3 votes
Accepted

Why can the Xbox360 not detect the Arduino Leonardo as keyboard?

Like Juraj and Majenko said. Arduino Keyboard library does emulate "Boot Keyboard". I use NicoHood HID library and now it works.
eolandro's user avatar
  • 141
3 votes

Using Keyboard library for ISO-UK layout

The USB keyboard protocol has no concept of characters. It doesn't know and doesn't care what character a key represents. Instead each code represents the location of the key on the keyboard, and it's ...
Majenko's user avatar
  • 105k
3 votes
Accepted

Save highlighted text as int variable

You have to write an application for your PC that reads a number from the clipboard adds some constant puts the result back in the clipboard quits Then you have to configure you desktop environment ...
Edgar Bonet's user avatar
  • 43.2k
3 votes
Accepted

Can't type backslash (\) with Keyboard library

You have to keep in mind that the Arduino doesn't send characters to the computer. Instead, it simulates key presses, and the computer has to translate those into characters, according to some ...
Edgar Bonet's user avatar
  • 43.2k
3 votes

Will an Arduino Nano work instead of Teensy 3.2?

No, you can't use Adruino Nano, because in this project the Teensy board has been used as an USB Keayboard and Nano has separate communication chip (FTDI or CH430) that can't emulate USB keyboard. ...
KIIV's user avatar
  • 4,752
2 votes

Send Keyboard Media Keys with Keyboard Library

If you are getting zeros, the most probably cause is it's the library for the IR. Reinstall or update the library. Sometimes you have to reinstall more than one time. That should work. About media ...
Jesus Ulloa's user avatar
2 votes
Accepted

Possible to create IP-to-USB HID (keyboard) device using Arduino?

Yes, it is perfectly possible. You ideally need an Arduino with a direct USB interface, such as the Leonardo. Then you can just access the Keyboard object to send the keystrokes to the PC. How your ...
Majenko's user avatar
  • 105k
2 votes

How can a USB keyboard emulator (TrinketKeyboard) type Unicode characters?

You could hack it. Make it press CMD+SPACE type terminal.app press ENTER type echo -e "\xC2\xAF\\_(\xE3\x83\x84)_/\xC2\xAF" | pbcopy press ENTER press CMD+Q press CMD+V though the user would see ...
Gerben's user avatar
  • 11.3k
2 votes

How can a USB keyboard emulator (TrinketKeyboard) type Unicode characters?

It depends entirely on the operating system you are working with. The Arduino is merely a keyboard. It sends keystrokes. Whatever keystrokes your operating system will accept to generate unicode ...
Majenko's user avatar
  • 105k
2 votes

How to reprogram Arduino if USB port is already in use?

https://digistump.com/wiki/digispark/tutorials/connectingpro It is suggested that in order to upload using the Arduino IDE you must: Add the repository http://digistump.com/package_digistump_index....
David Kerr's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible