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[] = {
B0000,
B0001,
B0010,
B0011,
B0100,
B0101,
B0110,
B0111,
B1000,
B1001};
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() {
i++;
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);
delay(1000);
}
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.