Summary: Why can I upload sketches to a Mega 2560 board by itself, but not when it is connected to a robotic arm?
I am using a Mega 2560 with a [sensor shield v2 from Sainsmart to control a [4-axis robotic arm.
The 2560 is connected to a Mac and to power using a two-pronged USB cable. One prong goes into power, and the other into the Mac to upload code. The prongs join together into one cord and are connected to a printer cable, which is then plugged into the 2560.
When my robot arm is not plugged in to the board, I can successfully upload any sketch to the board. When I plug the arm in, select the port that has the Arduino tag, and click upload, I get the following errors:
avrdude: ser_open(): can't open device "/dev/cu.usbmodem861": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
… some more repetitions of “write error: bad file descriptor”, “failed to send command”, “timeout”…
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude done. Thank you.
the selected serial port
does not exist or your board is not connected
When I next click on the port button, the port number has changed. When I select the new port number and try to upload, I get the same errors and the port number changes again.
I have tried: restarting the IDE with the board plugged in, using a different USB port, different printer cable, and searching Google and various forums. One person suggested opening the sketch from the program list instead of by clicking on the .ino file. When I click on the Arduino app, the sketch I am working on pops up, so I’m not sure how to get to the program list.
The only way to upload sketches that will work on the arm is to disconnect and re-connect the 12 wires that go from the board to the arm.
How can I upload programs to my board without disconnecting the arm every time I want to make a change? I’m a newbie to Arduino and would appreciate if anyone could point me in the right direction. Thanks for your help!](https://www.sainsmart.com/products/4-axis-desktop-robotic-arm-assembled/)](SainSmart Sensor Shield V2 For Arduino MEGA 2560 R3 1280 IIC Bluetooth LCD SD IO – SainSmart.com)