T-vK / ESP32-BLE-Keyboard

Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
2.28k stars 379 forks source link

Long vs sort key press #205

Closed dl5dla closed 1 year ago

dl5dla commented 1 year ago

Not an issue but just a question: Is it somehow possible to simulate long and short key press (e.g. based on the duration a ESP32 pin is pressed?

Thanks. Peter

dl5dla commented 1 year ago

I answer myself - yes, it works: bleKeyboard.press(KEY_RETURN); // press key for 500ms delay(500); bleKeyboard.releaseAll(); delay(100); bleKeyboard.press(KEY_RETURN); // press key for 100ms delay(100); bleKeyboard.releaseAll();

Thanks for the code, very helpful. I plan to connect a morse key to the ESP32. The microcontroller should then send the short and long keystrokes to my iPhone, which is running a morse-training app.