Arduino suddenly slow starting and uploading

Been using Arduino quite a lot lately and suddenly it is very slow on startup and uploads are hesitating for 20-30 seconds before even starting.

Problem 1:
The Arduino IDE startup is averaging 29 seconds! normally it will load and be ready to go in 5-10 seconds on this system.

Problem 2:
When I click the upload icon, it turns white but compiling doesn't start for 30 seconds or more. and during this time everything in the IDE is frozen. I can't add text, scroll, nothing. At some point long after clicking upload, the icon turns orange and compiling starts and uploads fine.

What can cause this?

I don't think it is my code, but here is a small but complete segment

boolean atHome = true;
boolean remoteCycle = true;
int buttonCount = 0;
int RED = 0xF800;
int zoneCount = 7;
int zonePin[8];
int BACKGROUND = 0;

struct zStruct
{
  int onSecs[6];
};
zStruct zones[3];

unsigned long tm, lasttm;

void setup()
{
  Serial.begin(115200);
  delay(500);
  zones[0].onSecs[0] = 5;
  zones[1].onSecs[0] = 10;
  DrawRemotePage();
}

void loop()
{
  delay(10);
}

/***************************************************************************************************************/
void DrawRemotePage()
{
  atHome = false;

  if (remoteCycle && !atHome)
  {
    ClearScreen();
    buttonCount = 0;
    DrawTime(1);
    DrawPumpStatus();
    WriteText(3, 90, 60, "Remote Activated", RED);
    //    Button(2, 190, 180, 90, 35, false, "Stop", RED, FILL, ExitRemote, 0);
    //    Button(3, 360, 260, false, 100, 35, "Home", BLACK, FILL, ExitRemote, 0);

    // start the first zone first time
    digitalWrite(zonePin[0], HIGH);                         // open zone 1 valve
    Serial.println("z1 valve open");
    PumpOn();                                               // turn on the pump

    lasttm = millis();
    tm = lasttm;

    while (tm - lasttm <= 5000ul)                           // 5 second delay
    {
      HeartBeat();                                          // check for touch and time update
      tm = millis();
    }

    PumpOff();                                              // turn off the pump
    DrawPumpStatus();

    lasttm = millis();
    tm = lasttm;

    while (tm - lasttm <= 4000ul)                           // 43 second delay
    {
      HeartBeat();                                          // check for touch and time update
      tm = millis();
    }

    digitalWrite(zonePin[0], LOW);                          // close zone 1 valve
    Serial.println("z1 valve closed");
  }

  ExitRemote(0);
}

void fillRoundRect(int x, int y, int l, int w, int champfer, int clr) {}
void Rotation(int r) {}
void ExitRemote(int n) {}
void CheckTimeDisplay() {}
void CheckRemote() {}
void Touch() {}
void HeartBeat() {}
void PumpOn()
{
  Serial.println("Pump on");
}
void PumpOff()
{
  Serial.println("Pump Off");
}
void ClearScreen() {}
void DrawTime(int n) {}
void DrawPumpStatus() {}
void WriteText(int tSize, int x, int y, String text, int Color) {}

First thing is to restart your computer.

it certainly sounds odd that it hangs in the compile & upload process.
Perhaps something is holding the port , or something else in that area.

So no errors, it just takes a long time to get going, then everything works as it should ?

Is anything else connected to the Arduino?

Close the IDE
open C:\Users\ %USERPROFILE%\AppData\Local\Arduino15\preferences.txt

find the section marked 'recent.sketches' and delete the list of sketchesyou find there , you MAY want to keep the first couple to keep your history access, down to run.display.

Restart the IDE.

1 Like

Thank you missdrew! you hit the nail on the head. There were tons of previous files and I deleted all of them. The IDE is working normally again.

Glad you were on here!!!