Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upload sketch after using Lilygo as a USB keyboard and mouse emulation #18

Open
francoisnicolas opened this issue Nov 20, 2023 · 2 comments

Comments

@francoisnicolas
Copy link

I have uploaded a sketch that transforms my lilygo ESP32-S3 in a USB keyboard and mouse emulator
The sketch works, but I can't upload a new sketch as the serial port is then disabled.
How can I erase the sketch or upload a new sketch ?
Is it possible to have serial port and USB keyboard and mouse emulator at the same time ?
(It's possible with an ardunion leonardo)

#include "USB.h"
#include "USBHIDKeyboard.h"
#include "USBHIDMouse.h"

USBHIDKeyboard Keyboard;
USBHIDMouse Mouse;
uint8_t buf[200];
void setup() {
// open the serial port:
Serial.begin(115200);
// initialize control over the keyboard:
Keyboard.begin();
Mouse.begin();
USB.begin();
Keyboard._onGetDescriptor(buf);
}

void loop() {
// check for incoming serial data:
if (Serial.available() > 0) {

// read incoming serial data:
char inChar = Serial.read();
Serial.print(inChar);
// Type the next ASCII value from what you received:
Keyboard.press(inChar);
Keyboard.releaseAll();

}
Mouse.move(20, 20, 0, 0);
Keyboard.press('Q');
Keyboard.releaseAll();
delay(3000);
}

@lewisxhe
Copy link
Contributor

Press and hold the button on the board, then insert USB

@JpEncausse
Copy link

I have uploaded a sketch that transforms my lilygo ESP32-S3 in a USB keyboard and mouse emulator The sketch works, but I can't upload a new sketch as the serial port is then disabled. How can I erase the sketch or upload a new sketch ? Is it possible to have serial port and USB keyboard and mouse emulator at the same time ? (It's possible with an ardunion leonardo)

#include "USB.h" #include "USBHIDKeyboard.h" #include "USBHIDMouse.h"

USBHIDKeyboard Keyboard; USBHIDMouse Mouse; uint8_t buf[200]; void setup() { // open the serial port: Serial.begin(115200); // initialize control over the keyboard: Keyboard.begin(); Mouse.begin(); USB.begin(); Keyboard._onGetDescriptor(buf); }

void loop() { // check for incoming serial data: if (Serial.available() > 0) {

// read incoming serial data:
char inChar = Serial.read();
Serial.print(inChar);
// Type the next ASCII value from what you received:
Keyboard.press(inChar);
Keyboard.releaseAll();

} Mouse.move(20, 20, 0, 0); Keyboard.press('Q'); Keyboard.releaseAll(); delay(3000); }

Hello @francoisnicolas did you find a way to let T-Dongle comunicate with a PC has a keyboard or WebUSB ?
I'm also looking for a simple demo to set communication between the device and a webpage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants