SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
#198890
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:
Code: Select all
    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"...
Code: Select all
    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!
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]