I tried to upload a program to Arduino Nano, and it will not work. I have also had a similar problem with an Arduino Uno.
Error Message-
Arduino: 1.8.12 (Windows 10), Board: "Arduino Nano, ATmega328P"
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "\\.\COM2": Access is denied.
I also am not able to open the serial monitor. It says the port is busy.
I have tried to change so many settings and I don't know what else to do.
The "Access is denied" error happens when the port is open in another application.
Make sure you have selected the port of your Arduino board from the Tools > Port menu.
Sometimes the port will be labeled with the board name in the menu. Other times it will not. If you don’t know which port is your Arduino board, you can find it like this:
Unplug your Arduino board from the computer.
Tools > Port
Note the ports, if any, listed in the menu.
Close the Tools menu. The ports list is only updated when the Tools menu is re-opened, so this step is essential.
Plug your Arduino board into the computer.
Tools > Port - The new port listed in the menu is your Arduino board.
Make sure you don't have any other applications running that might have the port open. Only one application can have a serial port open at a time.
Try restarting your computer. Sometimes a glitch causes the port to get stuck open and restarting fixes that.
The program still will not upload, but now it says-
Arduino: 1.8.12 (Windows 10), Board: "Arduino Nano, ATmega328P"
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified.