Hi there
I'm trying to use shiftOut() to control two 7 segment LED displays. I'm shifting out to a 4051 that is connected to two 4511 BCD to 7 segment decoders. The electronics are working fine, but the displays aren't counting up as they should. What I think is happening is that the value I'm sending out is being represented as a single byte rather than two nibbles, but I'm unsure how to fix it. I thought about somehow converting the number I'm shifting out into hexadecimal so that instead of getting to 9 and trying to represent 10(d) as A(h) it would skip straight up to 16(d), or 10(h).
Here's my code.
//Pin connected to Strobe (pin 1) of 4094
int strobePin = A3;
//Pin connected to Data (pin 2) of 4094
int dataPin = A4;
//Pin connected to Clock (pin 3) of 4094
int clockPin = A5;
//Pin connected to OE (pin 15) of 4094
int oePin = A2;
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(strobePin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(oePin, OUTPUT);
digitalWrite(oePin, HIGH);
}
void loop() {
//count up routine
for (int i = 0; i < 100; i++) {
//set strobe pin low to begin storing bits
digitalWrite(strobePin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, i);
//set strobe pin high to stop storing bits
digitalWrite(strobePin, HIGH);
delay(500);
}
}
Any help would be greatly appreciated =]