I tried it. It appears to!
Final code reads
// define the LED digit patterns, from 0 - 9
// 1 = LED on, 0 = LED off, in this order:
// 74HC595 pin Q0,Q1,Q2,Q3,Q4,Q5,Q6,Q7
// Mapping to a,b,c,d,e,f,g of Seven-Segment LED
byte seven_seg_digits[11] = { B11111100, // = 0
B01100000, // = 1
B11011010, // = 2
B11110010, // = 3
B01100110, // = 4
B10110110, // = 5
B10111110, // = 6
B11100000, // = 7
B11111110, // = 8
B11100110, // = 9
B00000000 // = 10
};
// connect to the ST_CP of 74HC595 (pin 3,latch pin)
int latchPin = 3;
// connect to the SH_CP of 74HC595 (pin 4, clock pin)
int clockPin = 4;
// connect to the DS of 74HC595 (pin 2)
int dataPin = 2;
// set switch 1 to pin 7, 2 to 8, 3 to 9 and 4 to 10
int switch1pin = 7;
int switch2pin = 8;
int switch3pin = 9;
int switch4pin = 10;
void setup() {
// Set latchPin, clockPin, dataPin as output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(switch1pin, INPUT_PULLUP);
pinMode(switch2pin, INPUT_PULLUP);
pinMode(switch3pin, INPUT_PULLUP);
pinMode(switch4pin, INPUT_PULLUP);
}
// display a number on the digital segment display
void sevenSegWrite(byte digit) {
// set the latchPin to low potential, before sending data
digitalWrite(latchPin, LOW);
// the original data (bit pattern)
shiftOut(dataPin, clockPin, LSBFIRST, seven_seg_digits[digit]);
// set the latchPin to high potential, after sending data
digitalWrite(latchPin, HIGH);
}
void loop() {
// write digits on button press
if (digitalRead(switch1pin) == LOW) { // Button 1 closed, wired the normal way, internal pull-up enabled.
sevenSegWrite(1);
}
if (digitalRead(switch1pin) == HIGH) { // Button 1 open, wired the normal way, internal pull-up enabled.
sevenSegWrite(10);
}
if (digitalRead(switch2pin) == LOW) { // Assume this is button 2, wired the normal way, internal pull-up enabled.
sevenSegWrite(2);
}
if (digitalRead(switch2pin) == HIGH) { // Button 2 open, wired the normal way, internal pull-up enabled.
sevenSegWrite(10);
}
if (digitalRead(switch3pin) == LOW) { // Assume this is button 3, wired the normal way, internal pull-up enabled.
sevenSegWrite(3);
}
if (digitalRead(switch3pin) == HIGH) { // Button 3 open, wired the normal way, internal pull-up enabled.
sevenSegWrite(10);
}
if (digitalRead(switch4pin) == LOW) { // Assume this is button 4, wired the normal way, internal pull-up enabled.
sevenSegWrite(4);
}
if (digitalRead(switch1pin) == HIGH) { // Button 4 open, wired the normal way, internal pull-up enabled.
sevenSegWrite(10);
}
}
Out of interest, what's the maximum power output capacity for the Uno? Will it happily run 7 3V 30mA LED's?
Once again, thankyou for your help. I hope I have shown that I've learnt a load from it. 