There are two(*) Keyboard.press() functions, one that handles KEY_xxx and one that handles ASCII:
class KeyboardAPI : public Print
{
public:
...
// Raw Keycode API functions
inline size_t write(KeyboardKeycode k);
inline size_t press(KeyboardKeycode k);
...
// Print API functions
inline virtual size_t write(uint8_t k) override;
inline size_t press(uint8_t k);
...
};
You need two typeKey() functions, too:
void typeKey(KeyboardKeycode key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
or use a template:
template <typename T> void typeKey(T key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
(*) Well, actually three:
class DefaultKeyboardAPI : public KeyboardAPI
{
public:
// Add special consumer key API for the reserved byte
inline size_t write(ConsumerKeycode k);
inline size_t press(ConsumerKeycode k);
...
};
class Keyboard_ : public DefaultKeyboardAPI
{
...
};
extern Keyboard_ Keyboard;