Error when uploading file

When uploading the sketch from the IDE I get “An error occurred while uploading the sketch”, I have Arduino Uno serial USB connection selected as the board connection and have copied and pasted the sketch code to the IDE. I have checked that my arduino is connected on COM3 and that it agrees in the IDE tools.

Hi @klupton,

Having not seen this one before I’m working a bit off of what I can find on Google for that error message. It seems like quite a number of people have run into this on occasion when trying to upload sketches in the Windows IDE.

Some things worth trying:

  • Make sure you have the latest IDE – I use the Mac version which doesn’t have any sort of update checker so I have to go back to that page on occasion for new builds.

  • I know you said the Tools menu of the IDE shows the correct port, but make sure it shows the correct board in Tools > Board as well

  • Some people mentioned just closing and re-opening the IDE or rebooting their computer helped, sounded like it was some issue with the USB port status in Windows

  • If the board is being powered solely off of a USB port, it’s possible its not delivering consistent voltage, so you can run power to the AC port on the Uno as well if you have the appropriate cable.

One more that has come up a lot in the results I’m reading. It sounds like the Windows IDE has some error where it will do this on occasion when you launch it by double-clicking an .ino file instead of opening the application, then the .ino file via its File > Open menu. That seems crazy to me, and it sounded like you were pasting it in anyway, but worth mentioning.

I don’t mean to be telling you to ‘go search Google’, but since this problem is occurring before Cayenne is involved (and it doesn’t look like a compiler issue with the sketch file), there is some value in Googling that error message just to see what others have tried, and what has and hasn’t worked for them. My apologies for the trouble you’re running into.

Certainly once you can get this thing uploaded, if there is trouble with the connection to Cayenne via the code in that script, I’ll be a better resource than Google :slight_smile:

OK now I can upload the sketch for the serial USB connection and the IDE says Done uploading but the cayenne dashboard does not automatically appear. The screen in Step Three continues to show waiting for board to connect.

The problem before is that I had a couple servos connected to Pin 0 and 1 and it was conflicting, including a PING sensor to another Pin. I have now disconnected everything and it uploads.

Cool, glad it’s uploading at least. That USB Serial connection sketch is probably the funniest of all of the various ways we have to connect so there are some gotchas.

It requires a batch file to be running as outlined in this part of the comments to the sketch file:

1. Set the token variable to match the Arduino token from the Dashboard.
2. Compile and upload this sketch.
3. Launch the connection script as described below for Windows or Linux/OSX.

	1. Open the Windows command line (cmd.exe)
	2. Navigate to the scripts folder by typing "cd [path]", e.g.  "cd C:\Users\[YourUserName]\Documents\Arduino\libraries\Cayenne\extras\scripts"
	3. Run the script by typing "cayenne-ser.bat -c COM4" (where COM4 is port with your Arduino) and hitting Enter`

So the next 2 things I’d check are that you have that script running with the correct COM port for your Arduino, and that you’ve entered your Cayenne token between the quotes in this line:

char token[] = "abcdegf12345";

You can grab your token from the same page that’s sitting on ‘waiting to connect’ right above that text, if you don’t already have it in the sketch.

I have tried everything. Think I will try a ethernet shield maybe that would be easier. What is the difference between the 5100, 5200 and the 5500. Would any of these three be easier than the other?

The w5100 is probably your best option. It’s the cheapest and least complex of them all.

It looks like the 5100 is discontinued on the website. The 5500
based shield is called the Arduino Ethernet Shield V2.

“Welcome to Paradise”

From personal experience I would say stay away from the 5500. I couldn’t find much in documentation on it as far as using all the bells and whistles it has anyway (if anyone has any links they would be appreciated) so it’s basically only an ethernet shield with a bloated library.

Thanks adam just ordered one of these to try it out.

Very cool, I’ve got an ethernet shield connected to cayenne and we created our first LED light circuit this morning. Now cayenne says it’s offline, how do I reconnect the board or reboot.

There are no remote commands in Cayenne for Rebooting an Arduino in the same way that we have for Raspberry Pi. (and not that they would work anyway if we see the device as offline). I would just power cycle it – the last sketch that’s been flashed to it will be retained through the power cycle.