Error when uploading - system cannot find file specified (not OneDrive issue)

Arduino: 1.8.12 (Windows 10), Board: "Arduino Uno"

Sketch uses 1784 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 185 bytes (9%) of dynamic memory, leaving 1863 bytes for local variables. Maximum is 2048 bytes.
C:\Users\sange\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\sange\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM23 -b115200 -D -Uflash:w:C:\Users\sange\AppData\Local\Temp\arduino_build_63263/test.ino.hex:i

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\sange\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

Using Port : COM23
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "\.\COM23": The system cannot find the file specified.

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.

The above is the error message. I'm completely new to Arduino, and I'm just trying to upload for the first time. My code is just this:

char serialData;
int pin = 7;

void setup() {
// put your setup code here, to run once:
pinMode(pin,OUTPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0)
serialData = Serial.read();
Serial.print(serialData);

if(serialData == '1'){
digitalWrite(pin,HIGH);}
else if(serialData == '0') {
digitalWrite(pin,LOW);}
}

My sketchbook location is:

C:\Users\sange\Documents\Project\Arduino

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.

I followed your advice. I was always using the same port as the Arduino UNO was using, but for some reason it seemed to work anyway? Perhaps restarting and unplugging the Arduino was a necessary fix.