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);
  • 7
    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, 2015 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, 2015 at 19:15
  • 4
    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, 2015 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, 2018 at 18:11

6 Answers 6


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.

  • 1
    I think this is a reasonable answer - sometimes people misinterpret one delay for another Jul 29, 2015 at 21:43

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.


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).


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'.

  • 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. :-) Dec 9, 2016 at 17:55

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.


Try downloading CH340 drivers. You must not have drivers for uploading the code to arduino board and to identify the right COM port. Download and install the drivers, find the COM port number from device manager and update Tools->Port in your Arduino IDE.

  • 1
    I'm curious to know what the thinking behind this is.
    – timemage
    Nov 29, 2020 at 13:44
  • I am not that active so sorry to reply so late. I believe that OS had drivers for some of the Arduino devices but it didn't had the appropriate drivers to communicate with my Arduino Nano. I struggled through the comments with no benefit and as soon as I figured out, I posted the solution here. Mar 17, 2021 at 16:04

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