Pin13 blinking and cant upload to arduino

I uploaded this program to my arduino UNO:

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
byte Dig[] = {

int Num[6] = {0,0,0,0,0,0};
int i = 0;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  for(int x = 0;0<6;x++){
  Num[x] = x + 1;

void loop() {

  if (i==10)i=0;
  byte Digit[3];
Digit[0] = (Num[1] << 4) | Num[0];

  digitalWrite(latchPin, LOW);

  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);
  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);
  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);

  digitalWrite(latchPin, HIGH);

And even though there is no mention of pin13, it is blinking. and even though it has a 1 second delay, it is blinking very fast, like 50 or 100 milliseconds delay. And now I cannot upload, i get the error:

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

I thought maybe I had messed up the atmega, so i put a new one in, uploaded this program fine, but the exact same thing is happening again. Im just trying to put the blink program on it and I get that error. Ive gone though the troubleshooter, unplugged everything, but I get the same results. The loop-back test or whatever its called works fine.

All different timings of manual resetting don't help either.

Third and last atmega wont upload a new program at all, even after double checking the board settings and everything.

Look (really look) at the following line:

for(int x = 0;0<6;x++)



A lot of Uno boards were apparently shipped with a defective bootloader that causes problems under certain conditions. You can try the old-fashioned way:

Load a simple sketch (the Blink example).

Hold the Uno reset button down and click the Arduino “Upload” icon. As soon as the window at the bottom of the Arduino IDE reports "Binary sketch size: " release the Uno reset button. It may take some practice to get the timing right…

Doh! I totally fixed that days ago but didnt save because my arduino app was running off a flash drive that a accidentally removed before saving.

Anyway I've tried all sorts of manual resets with no luck. Just keep trying?

Oh, im using bootloaded atmegas from sparkfun, not the one that came with it.

that's probably it. the atmega that come bootloaded from sparkfun are for the dicemelia. not for the uno. they just came out with the new ones this friday on the new product post. but i doubt those could arive that fast.

I've tried it set for the UNO, Duemilanove and Dicemelia. I've tried holding reset until all different intervals of time, and still nothing.

The weird thing is that I didn't have this problem with the sparkfun chip until I uploaded this sketch. But now that I am having this problem it applies to even a fresh chip I haven't opened yet.

Oh, by the way, I see what the error was with my coding, but why is pin 13 blinking?

Also I should mention that I managed to upload this bad code to another chip with no problem after having trouble with the first. When I got to the third chip I just tried the blink example and had no luck.

I built a parallel programmer, installed giveio and set the registry entry for winxp and I get this error:

avrdude: AVR device not responding avrdude: initialization failed, rc=-1 avrdude: Yikes! Invalid device signature. avrdude: Expected signature for ATMEGA328P is 1E 95 0F avrdude: AVR device not responding ***failed; avrdude: verification error, first mismatch at byte 0x0000 0x05 != 0x07 avrdude: verification error; content mismatch

can I get any advice?