I am trying to upload this simple sketch into my arduino with a shield I made. It takes forever (note I have the right COM port on)

  int sensorValue = 0;

  void setup(){ 

  void loop(){
     sensorValue = analogRead(A4);
  • 6
    Enable verbose output in the settings. That way you can see what's going on, and what part of the compiling and uploading process takes so long. Also make sure you have an up to date version of the Arduino IDE, as some previous version didn't cache the previously compiled libraries properly. – Gerben Jul 29 '15 at 15:09
  • if you want such a long delay in loop(), you should use the millis() function, it should free the MCU for other stuff. – RSM Jul 29 '15 at 19:15
  • 2
    Please copy and paste the messages you see when uploading. Why are you waiting 2.7 hours before displaying the value you read? How does that help? – Nick Gammon Jul 29 '15 at 20:38
  • My solution was to select the right version of the board (Tools->Board) mine was Arduino Leonardo. It was selected something else.. – Cristi Nov 24 '18 at 18:11

Are you sure the problem is in the upload time? delay() takes the number of milliseconds you want to wait. In your code, it should take about 3 hours before the Arduino sends some data through the serial port.

| improve this answer | |
  • 1
    I think this is a reasonable answer - sometimes people misinterpret one delay for another – AMADANON Inc. Jul 29 '15 at 21:43

Check the end of this thread for the reply by 'Toshibass', Unbelievable slow compilation of simple sketches

I was having same same problem compile took > 3 minutes for small sketch using serial or OTA however I found solution The program that was slowing down compile was IBM's Trusteer .. Rapport which is a fraud prevention program distributed by my bank once I de-installed it, same compile took 10 seconds, now all I need to do is find an alternative or hope IBM produce a fix after I filled in a issue report to them.

It worked for me, the culprit was some software called 'Trusteer'.

| improve this answer | |
  • 1
    I have added a direct link to the post that you refer to, as well as quoting the reply. As it stood, your answer was a "link-only answer". Please provide greater detail in your future answers. :-) – Greenonline Dec 9 '16 at 17:55

If the problem does indeed lie in the upload (see DoubtBearer's answer), then you should turn on verbose output, to see exactly what part of the upload is giving issues.

In your IDE, click File -> preferences; look for the section "Show verbose output during:" and tick both Compilation and Upload.

Re-run your upload, and see what is taking up all the time. If you can't figure it out from that, please post the log (it will appear in the black area at the bottom of the IDE, you should be able to cut & paste).

| improve this answer | |

I had the same problem. I noticed that the RX & TX LEDs we're not flashing as they normally do when I upload a file. I'm using an older knock off nano.

My solution: Under Tools> processor.... I switched from the defaulted "ATmega328P" to the "ATmega328P(Old Bootloader)" option. The next upload attempt was quick and successful. Normal flashing RX &TX LEDs during the upload as well. Hope this helps someone.

| improve this answer | |

If you are taking too much time for uploading means there is communication between another device is happening, please remove all TX and RX pins.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.