EspTinyUSB: Both Mouse and keyboard is not working in one sketch
I need to have both mouse and keyboard working from one esp32-s2. So i tried this code but in device manager of windows does not recognize the device. NT: i tried both seperately and they work fine.
/**
* Simple HID keyboard
* author: chegewara
*/
#include "hidkeyboard.h"
#include "Arduino.h"
#include "hidmouse.h"
HIDmouse mouse;
HIDkeyboard dev;
void setup()
{
Serial.begin(115200);
dev.begin();
mouse.begin();
}
void loop()
{
delay(10);
uint8_t key_val = 'k';
dev.sendChar(key_val); // send ASCII char
delay(1000);
mouse.doublePressLeft();
delay(1000);
mouse.pressRight();
delay(1000);
mouse.move(-105, -105);
delay(1000);
mouse.pressLeft();
delay(1000);
mouse.scrollUp(1);
delay(1000);
mouse.scrollDown(1);
delay(1000);
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (10 by maintainers)
The reason is the library is not ready to use separate mouse and keyboard.