Thanks for the replies. Its really helping me learn. I have now advanced to using 2 74HC595 to drive 2 digits on 7 segment displays. I have started using arrays as advised in this thread. Both digits are now counting from 0 to F. I want to next learn how to have each digit count independently. Can you suggest how this can be done? Or point me to some information i can read to learn myself. Here is my code so far:
#define dataPin 2
#define latchPin 3
#define clockPin 4
#define DT 500
byte digits []{
0x81, //0b10000001; 0
0xF3, //0b11110011; 1
0x49, //0b01001001; 2
0x61, //0b01100001; 3
0x33, //0b00110011; 4
0x25, //0b00100101; 5
0x05, //0b00000101; 6
0xF1, //0b11110001; 7
0x01, //0b00000001; 8
0x21, //0b00100001; 9
0x11, //0b00010001; A
0x07, //0b00000111; B
0x8D, //0b10001101; C
0x43, //0b01000011; D
0x0D, //0b00001101; E
0x1D, //0b00011101; F
};
void setup() {
pinMode(latchPin,OUTPUT);
pinMode(dataPin,OUTPUT);
pinMode(clockPin,OUTPUT);
}
void loop() {
for (int i=0;i<=15;i=i+1){
digitalWrite(latchPin,HIGH);
shiftOut(dataPin,clockPin,MSBFIRST,digits[i]);
shiftOut(dataPin,clockPin,MSBFIRST,digits[i]);
digitalWrite(latchPin,LOW);
delay(DT);
}
}

