I'm Having a fatal error when uploading my code to the ESP32.
Sketch uses 893410 bytes (68%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45060 bytes (13%) of dynamic memory, leaving 282620 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port COM5
A fatal error occurred: Could not open COM5, the port is busy or doesn't exist.
(could not open port 'COM5': OSError(22, 'The semaphore timeout period has expired.', None, 121))
Failed uploading: uploading error: exit status 2
This is my error code.
I don't understand what to do.
If your ESP32 is COM5, then when it's plugged into your PC's USB port you should see COM5 in the list, and when you unplug it, it should disappear from the list.
If it is showing up correctly in device manager then check that the serial monitor / plotter are not open. IIRC some versions of the IDE give that error when the serial monitor is open and an upload is attempted.
If that doesn't fix it then check nothing else is using COM5. It's unlikely, but if e.g. you have some other code running that's opened COM5, that would also cause the problem.