unable to upload code

Hi Guys,

For some reason I’m not able to upload my code. I’m using an arduino mega 2560, and trying to upload the code below. For some reason though it keeps timing out after about 5-10 minutes. It was working fine a few weeks ago with similar code. I’m also using Parallel programmer as the programming option, and 9600 baud rate. Any thoughts or suggestions would be greatly appreciated

#include <Wire.h>

void setup()
{
//join I2C bus
Wire.begin();
Serial.begin(9600);
}

void loop()
{
int count = 0;
while(count < 5000){
//set pointer to STATUS register(0x00)
Wire.beginTransmission(0x48);
Wire.write(byte(0x00));
Wire.endTransmission();

//read STATUS register
Wire.beginTransmission(0x48);
Wire.requestFrom(0x48,1);
byte c = Wire.read(); // receive a byte as character
//Serial.print(c);
//byte stat = Wire.read();
Wire.endTransmission();

if(c == 0x00)
Serial.println(“Status == 0 \n device is not ready”);
else if(c == 0x01)
Serial.println(“STATUS == 1 \n device is ready”);

count++;
}

}

Are you able to upload and empty sketch? Or a blinky sketch?

Yea I actually got it worked out. As long as I press the Re-set button at the right time during the upload (or just before) I have no problem uploading the code.