error occurred while uploading the sketch

whats the error?

You haven't said which versions you're using but there is a bug in Arduino IDE 1.6.10(and possibly Arduino AVR Boards 1.6.12 used with any IDE version) that can cause that error when you start the IDE by opening a sketch(.ino) file(by double clicking on it, etc.). Please try this:

  • Close all Arduino IDE windows
  • Start the Arduino IDE, not by opening a sketch file.
  • Open the sketch file via File > Open, File > Sketchbook, or File > Examples

The last opened sketch will automatically load when you open the Arduino IDE, that one should also work fine.