void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
}
// the loop function runs over and over again forever
void loop() { // wait for a second
Serial.write("hello");
delay(2000);
}
when I compile and upload a code to the nano it's showing this:
Sketch uses 1608 bytes (5%) of program storage space. Maximum is 30720 bytes.
Global variables use 190 bytes (9%) of dynamic memory, leaving 1858 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\.\COM9": The system cannot find the file specified.
Global variables use 190 bytes (9%) of dynamic memory, leaving 1858 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0
Failed uploading: uploading error: exit status 1
If your serial monitor is open, close it before starting the upload. There is a known issue regarding this with IDE 2.x.
Does that mean that when you disconnect the board you have none and when you connect the board you get two ports at the same time? That would indicate a Windows issue.
Hi @jayakrishnamarni. You described the Arduino board you are uploading to as "Nano". Something that can be confusing is there are multiple boards with "Nano" in their name. We need to be certain of exactly which one you have. The reason is that the problem might be caused by the IDE not being correctly configured for your specific board.
Please tell us which of the following boards you are attempting to upload to:
classic Nano (including clone/derivative boards as long as they have the ATmega328P microcontroller)
If you aren't sure which one you have, you can provide a picture of the board or a link to the place you bought it from and we'll see if we can identify it.