Help please. Error uploading to Arduino..

My Arduino software and board have been working perfectly until now.
When I run a simple Digital Read Serial program I get the follow error when I try to upload it to my Arduino.

Binary sketch size: 2248 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

It appears both my Board type and COM port are correct so I'm not sure what else it could be ..

Which model/board do you have?

This error is usually the result of the ATmega not getting reset automatically.

Try pressing the Reset button on the board just after the "Binary Sketch Size" message. You might have to try a couple of times to get it just right.

The Arduino script I am running is a simple "Digital serial read" script.
here is the script:
void setup() {
Serial.begin(9600);
pinMode(0, INPUT);
}
void loop() {
int sensorValue = digitalRead(0);
Serial.println(sensorValue, DEC);
}

I have discovered if I set my input pin to 0 I get the error message as outlined in the beginning of this post. If I set my input to 1 I get a strange serial output (not what I am expecting). If I set it to 2 I get the serial output I am expecting.

Are the digital pins 0 & 1 reserved for something else ?

Digital pins 0 and 1 are shared with the serial communication that goes over USB to the computer.

If you are using serial communication, then you can't use pins 0 and 1. They're used in the background to talk to the computer.

I had the same problem with my Uno same sketch and same error codes.
I am running Vista sp2 on a toshiba laptop.

I solved the problem by logging as admin and all worked as it should.

The guess as to the reason why, Vista in their weird way prevents access to serial ports unless in admin as a security measure (by the way I just got rid of a nasty bit of adware(netbits) which came thru a user account so much for security)

I seem to have also developed this problem (and on the eve of my greatest breakthroughs on my project, too). I circumvented it by going back to the 0021 IDE and running it as Admin (still using the 0022 drivers, though). Uploads every time now.

Strangest thing - worked fine for 2 months, until now. All of my problems seem to have stemmed from switching to the 0022 drivers and IDE.
ETA: Ran 0022 as Admin, and uploaded just fine.