Arduino Nano V3 only runs sketch correctly after hitting reset or starting serial monitor

Am I going to be able to time my functions without delays? That is why i used the while function here thou it is bulky!