I've just bought a new pro-micro and I want to simulate some keyboard inputs with it, the thing is the Arduino IDE (version 2:1.0.5) can't seem to find neither HID.h or Keyboard.h libraries. The steps to reproduce the problem are:
- plug the device using usb cable on the pc
- Open arduino ide
- try to compile my code
- it fails with the error
test_keyboard.ino:27:22: fatal error: Keyboard.h: No such file or directory compilation terminated.
The code is:
#include <Keyboard.h>
void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
/* Init function */
void setup()
{
// Begining the Keyboard stream
Keyboard.begin();
delay(400);
//Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_CTRL);
Keyboard.press(KEY_ALT);
Keyboard.press(KEY_T);
Keyboard.releaseAll();
delay(100);
Keyboard.print("echo 'hello world'");
typeKey(KEY_RETURN);
delay(100);
// Ending stream
Keyboard.end();
}
/* Unused endless loop */
void loop() {}
By the way, I'm running this on linux, after pluging it and running lsusb
on terminal I got:
Bus 002 Device 071: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)