// These are connected to 74HC595 shift register (used to show game score):
const int LATCH_PIN = A1; // 74HC595 pin 12
const int DATA_PIN = A0; // 74HC595pin 14
const int CLOCK_PIN = A2; // 74HC595 pin 11
int count =0;
void setup() {
pinMode(LATCH_PIN, OUTPUT);
pinMode(CLOCK_PIN, OUTPUT);
pinMode(DATA_PIN, OUTPUT);
digitalWrite(LATCH_PIN, LOW);
}
/* Digit table for the 7-segment display */
const uint8_t digitTable[] = {
0b11000000,
0b11111001,
0b10100100,
0b10110000,
0b10011001,
0b10010010,
0b10000010,
0b11111000,
0b10000000,
0b10010000,
};
void loop() {
shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, digitTable[count]);
digitalWrite(LATCH_PIN, HIGH);
digitalWrite(LATCH_PIN, LOW);
delay(1000);
if (count== 9){
count =0;
} else{
count+=1;
}
}