It can drive an 8x8 LED matrix. Updating the "wrong" 7-seg display will be a pain but fixable in software... I'm not sure about the 14V requirement of your display.
Do you have an updated schematic? (Assuming you are using 3 shift register)
You need to
Calculate the value of each digit
Use a lokuptable to convert the value to "segment-data"
Shift the segment data out into the shift register
// AA
// F B
// F B
// GG
// E C
// E C
// DD
//
// AFEDBGCx
static const uint8_t lookup[10] = {
0b11111010, // 0
0b00001010, // 1
0b10111100, // 2
0b10011110, // 3
0b01001110, // 4
0b11010110, // 5
0b11110110, // 6
0b10001010, // 7
0b11111110, // 8
0b11011110, // 9
};
void doit(){
int value = 123;
int a = value % 10;
int b = (value / 10) % 10;
int c = (value / 100) % 10;
uint8_t as = lookup[a];
uint8_t bs = lookup[b];
uint8_t cs = lookup[c];
shiftOut(dataPin, clockPin, bitOrder, as);
shiftOut(dataPin, clockPin, bitOrder, bs);
shiftOut(dataPin, clockPin, bitOrder, cs);
// and here pulse the latchPin
}
It can be wired to accept common Anode displays. There are plenty of people who have done this in the past. Just search the forum for it.
The only drawback is you can't use the internal binary to seven segment conversion you have to do in in software. This is a small price to pay, which you will have to do anyway once you get your current arrangement working.
1. Build the following multiplexed display unit as per Fig-1. In a multiplexed display unit, the identical segments pins are shorted together and the CA-pin are kept isolated. Adjust R1 = R2 = R3 for acceptable brightness of the CA-type display units. Note that the use of inverting type buffer ULN2003 has made the CA-type display unit to have been seen by UNO as CC-type display unit.
@PaulRB
Hi Paul,
I just saw your replies on that forum and I wish u could help me.
I have the same circuit counting 0 to 999 but no flex sensor in the Input, I have a limit switch sensor ( just like a push button pressed or not pressed )
I have a 6 14V common Anode 7-segments each 2 display the same number
I'm using 74HC595 with ULN2803 Driver and each ULN2803 drive will be connected with separate resistors to 2 7 segments
const int buttonThreshold = 500;
int lastButton = 1023;
I dont understand what these values are, and will it work in my case using a push button not a flex sensor?
I didnt connect it as hardware yet, I'm trying to make the simulation work 1st
Or the simulation in proteus maybe have some bugs thats why not working on it?
Those values are related to the flex sensor. Some changes to the sketch will be needed for use with a button, but they are not difficult. The flex sensor gives a value between 0 and 1023 (analogRead()), but with a button you get only HIGH or LOW (digitalRead()).
int buttonNow = analogRead (Button);
unsigned long timeNow = millis();
if (buttonNow <= buttonThreshold && lastButton > buttonThreshold && timeNow - lastPressed > 50) {
if (++num > 999) num = 0;
lastPressed = timeNow;
}
lastButton = buttonNow;
It'll will be
int buttonNow = analogRead (Button);
unsigned long timeNow = millis();
if (buttonNow == HIGH)
num = num + 1;
if (num > 999) num = 0;
if (reset == HIGH)
num = 0;
Will that count on every time I push the button? Even if the button is still pressed, the count will remain as it is right?
Yes, I got it wrong my mistake
It'll be like that, I tried it in Proteus and it worked.
But there's something, when I push the reset button, The counter gets to 0
when I push the button to count again It doesn't count, Once I push the reset the counter remains 0
currState = digitalRead(upPin);
if (prevState != currState)
{
prevState = !prevState;
if (currState == HIGH && counter < 999)
counter++;
if(counter == 999) counter = 0;
}
resetState = digitalRead(resetPin);
if (resetState == HIGH) counter = 0;
It worked, Thanks man
I understand nw, INPUT only it doesn't know the state of the button pressed or not pressed, so the counter remains 0 after I push the resetButton.
When I defined it as INPUT_PULLUP and check if its low, the counter gets to 0 only if it's pressed
resetState = digitalRead(resetPin);
if (resetState == LOW) counter = 0;