I have an Elegoo MEGA 2560 R3 Board ATmega2560 ATMEGA16U2 and am using the Arduino 1.8.3 IDE to run a simple sketch-see below:

#include <Servo.h>
Servo myservo

void setup()

void loop()

I am running the Arduino IDE on an iMac computer, with macOS Sierra, v 10.12.5 as the operating system. The PORT that shows on the sketch window is: /dev/cu.usbmodem913.

The problem I am having is that each time I attempt to upload the sketch, shown above, the port number changes, ie. it will change to /dev/cu.usbmodem1431 or some other number, so that each time I try to upload the sketch an error occurs that reads: “the selected serial port
does not exist or your board is not connected”.

How do I get the computer and the IDE to use a single PORT number so that I can upload the sketch? Any ideas or help would be most appreciated.


Arduino error description.txt (2.67 KB)

What do you mean with

The PORT that shows on the sketch window is: /dev/cu.usbmodem913.

Have you selected the port in 'the menu ?


Thanks for your reply. Yes, I have selected the port in the menu. What I mean by "on the sketch window", is, as you know, when you first open the Arduino IDE it brings up the last sketch window that was used. On the very bottom line of that sketch window is where the port name shows. It is on the line below where any of the error statements appear. Each time I have tried to upload the sketch I have had to select the port in the menu, but the number changes as soon as I click on the upload button. I have an Arduino Uno clone and this does not happen with it. Any ideas?


Well, that would seem to indicate that your USB keeps plugging and unplugging itself. Are your cables ok? Perhpas your arduino is resetting itself periodically - perhaps trying to drive something that is pulling too many amps?

Agree with Paul - seems you keep disconnecting / reconnecting

Try just plugging in your arduino clone with nothing connected on it, and try a different the USB cable in case it's faulty.

On my mac I don't see that behavior. In the menu at the top of the screen when your arduino is plugged in what is the list of ports you see?