Arduino upload problem "sync"

"Hi, i am from germany -> my english isn`t the best.

When i will upload any programm i get this message:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

The Problem is: I have upload this Script

loop() ...
...
if(Serial.available() > 0) {
      menu_stopp = 0;
      Serial.flush();
} 
....

How can i reset the completly Controller about USB ? What can i do ?

Jomelo

edit 1: Chip: ATmega 328 Board: Arduino Duemilanove 2009 edit2: I have test the connection on zwo two pc`s

Are you using arduino software version 0016? By the way, when did you get your mega? There's also some discussion over here:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243607033

The code in the sketch is not the problem. The problem is the computer is not talking to the Arduino.

A lot of people - myself included - got the same error because we had the wrong board selected. There is both a Duemilanove 328 and a Duemilanove 168, and choosing the wrong one gives this error. Go to and make sure you selected the correct one.

Another common problem is having the wrong COM port selected.

Other than that, check out the troubleshooting page: http://arduino.cc/en/Guide/Troubleshooting#toc2

Good luck!