avrdude: ser_open(): can't open device "\\.\COM2": Access is denied.

Arduino: 1.8.5 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

Archiving built core (caching) in: C:\Users\admin\AppData\Local\Temp\arduino_cache_86965\core\core_arduino_avr_pro_cpu_16MHzatmega328_0c812875ac70eb4a9b385d8fb077f54c.a Sketch uses 928 bytes (3%) of program storage space. Maximum is 30720 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes. C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM2 -Uflash:w:C:\Users\admin\AppData\Local\Temp\arduino_build_334735/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM2 Using Programmer : stk500v1 avrdude: ser_open(): can't open device "\.\COM2": Access is denied.

avrdude done. Thank you.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

I have tried changing ports!

This error indicates that something already has the port open. If you have another program running that has the COM port open then you need to close it. If you don't have any such program running then try restarting your computer. Sometimes there is some glitch and the port gets stuck open.

Occasionally, software which is meant to interact with serial devices (usually modems) will assume any serial device is a modem (or whatever type of serial device the software is made for), and start trying to talk to it as such. This is much less common nowadays, since modems are so rare, but it is occasionally still encountered - so something to keep in mind if other explanations don't pan out.