<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can&#x27;t upload sketch after using Lilygo as a USB keyboard and mouse emulation]]></title><description><![CDATA[<p dir="auto">I have uploaded a sketch that transform my lilygo ESP32-S3 in a USB keyboard and mouse emulator<br />
The sketch works, but I can't upload a new sketch as the serial port is then disabled.<br />
How can I erase the sketch or upload a new sketch ?<br />
Is it possible to have serial port and USB keyboard and mouse emulator at the same time ?<br />
(It's possible with an ardunion leonardo)</p>
<p dir="auto">#include "USB.h"<br />
#include "USBHIDKeyboard.h"<br />
#include "USBHIDMouse.h"</p>
<p dir="auto">USBHIDKeyboard Keyboard;<br />
USBHIDMouse Mouse;<br />
uint8_t buf[200];<br />
void setup() {<br />
// open the serial port:<br />
Serial.begin(115200);<br />
// initialize control over the keyboard:<br />
Keyboard.begin();<br />
Mouse.begin();<br />
USB.begin();<br />
Keyboard._onGetDescriptor(buf);<br />
}</p>
<p dir="auto">void loop() {<br />
// check for incoming serial data:<br />
if (Serial.available() &gt; 0) {</p>
<pre><code>// 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();
</code></pre>
<p dir="auto">}<br />
Mouse.move(20, 20, 0, 0);<br />
Keyboard.press('Q');<br />
Keyboard.releaseAll();<br />
delay(3000);<br />
}</p>
]]></description><link>https://www.community.lilygo.cc/topic/823/can-t-upload-sketch-after-using-lilygo-as-a-usb-keyboard-and-mouse-emulation</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 09:21:14 GMT</lastBuildDate><atom:link href="https://www.community.lilygo.cc/topic/823.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Nov 2023 10:31:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t upload sketch after using Lilygo as a USB keyboard and mouse emulation on Mon, 20 Nov 2023 15:03:27 GMT]]></title><description><![CDATA[<p dir="auto">You need to enter upload mode by first pressing Boot, then press and release Reset, then release Boot.<br />
After upload you may have to unplug the board and plug it back in.</p>
<p dir="auto">You can also "erase all flash before uploading" but it takes a long minute!</p>
<p dir="auto">I have no experience with keyboards and mouse on ESP32, as I consider a Rasp pi a better choice for 'that sort of thing'.</p>
]]></description><link>https://www.community.lilygo.cc/post/1449</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1449</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Mon, 20 Nov 2023 15:03:27 GMT</pubDate></item></channel></rss>