Code not compiling to nano

I am using a nano as a receiver and an uno as a transmitter. The uno is connected to port COM3 and the nano to port COM4. But the code for the nano won't upload to the nano. I have tried all the different bootloaders incase the board was an old one. But still nothing.

here is the code:
image

here are the error messages:
Arduino: 1.8.16 (Windows Store 1.8.51.0) (Windows 10), Board: "Arduino Nano, ATmega328P"

Sketch uses 1910 bytes (6%) of program storage space. Maximum is 30720 bytes.

Global variables use 184 bytes (8%) of dynamic memory, leaving 1864 bytes for local variables. Maximum is 2048 bytes.

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x42

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x42

Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.

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

There is a list of things that can be wrong.
Start here:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.