In the future use the COPY ERROR MESSAGES button. Did you turn on VERBOSE?
Do a screen grab of the board selector and post it.
-
What Arduino do you have ?
-
What board did you select in the IDE ?
-
Do you have the driver for your Arduino USB interface installed ?
Windows 11 and 10 like to select a COM port every time you restart or wake the computer, restart the IDE or even open a "new" IDE. My Windows 11 has one COM port, but depending on what I did, the port number has been 3, 4, 5 or 6. Therefore, I always need to do this:
IDE >> TOOLS >> PORT >> (your port)
And then I need to re-select my board...
IDE >> TOOLS >> BOARD >> AVR BOARDS >> (your board)
I can not reproduce the error with an official Uno.
I can reproduce the error with a SparfkFun RedBoard (an Uno in disguise) which uses the FT232xx serial-to-USB converter. It happens when I have the serial monitor open (and is a known bug: "Access is denied" error when uploading to board w/ FTDI USB chip with Serial Monitor/Plotter open · Issue #1783 · arduino/arduino-ide · GitHub).
Are you using an official Uno or a clone with another serial-to-usb converter? If the latter, which one?
"C:\Users\bugge\AppData\Local\Arduino15\packages\arduino\tools\avrdude\8.0.0-arduino1/bin/avrdude" "-CC:\Users\bugge\AppData\Local\Arduino15\packages\arduino\tools\avrdude\8.0.0-arduino1/etc/avrdude.conf" -v -patmega328p -carduino "-PCOM3" -b115200 -D "-Uflash:w:C:\Users\bugge\AppData\Local\arduino\sketches\B58671A6468D52470DA9A1746B2E399A/Blink.ino.hex:i"
Avrdude version 8.0-arduino.1
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\bugge\AppData\Local\Arduino15\packages\arduino\tools\avrdude\8.0.0-arduino1\etc\avrdude.conf
Using port : COM3
Using programmer : arduino
Setting baud rate : 115200
Error: cannot open port \\.\COM3: Access is denied.
Error: unable to open port COM3 for programmer arduino
Avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Yeah, true. But let me say on my windows 10 and 11 systems (and CH340 driver used for my "clones", e.g. UNO, WeMos D1, ESP8266...), the COM port number is "assigned" based on which USB port I plug the board in. Plugging the cable in the same USB port gives the same COM port number. If I plug it in a different USB port results in a different COM port.
I even put a little label on the USB ports of the hub I use on my development PC, so I can immediately "know" which COM port is assigned when I plug in a board, and if it's different than the one selected in the IDE, I just do what you rightly said.
IMO it's not that hard to do or understand, for me. ![]()
