//this is the code to show numbers 0-9 for 7 segmen using shift register
const int dataPin=8;
const int latchPin=10;
const int clockPin=11;
//the binary numbers of 0-9 are initialized in an array
int dataArray[10]={0B00000011,0B10011111,0B00100101,0B00001101,0B10011001,0B01001001,
0B01000001,0B00011111,0B00000001,0B00001001
};
void setup() {
pinMode(dataPin,OUTPUT);
pinMode(latchPin,OUTPUT);
pinMode(clockPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
for(int index=0;index<9;index++)
{
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,dataArray[index]);
digitalWrite(latchPin,HIGH);
delay(1000);
}
}