This is all just an experiment to see what I can do with a display I bought by accident. I took a sketch from an old forum discussion and modified it. I didn't know if I would see an output since the input part of the sketch needs lots of work, meaning I don't know how to go about it.
What I see is H.8.8.G.
I'm just trying to find a use for this extra piece of hardware by experimenting.
/* Name : 4x7 display
Author : Philip Minch
Originator : adapted from sketch by brys912
Created : 2025-05-15
Modified :
Version : 1.0
Driving 4-digit, 7-segment LED display
through a 74HC595 shift register
*/
// connections to NXP 74HC595N shift register IC:
int dataPin = 9; //74HC595 pin 14 DS
int latchPin = 10; //74HC595 pin 12 STCP
int clockPin = 11; //74HC595 pin 11 SHCP
// connections to YSB-439AB-4B-35 digit enable pins
const int digit1 = 7; // display pin 1, ones place common cathode
const int digit2 = 8; // display pin 2, tens place common cathode
const int digit3 = 12; // display pin 6, hundreds place common cathode
const int digit4 = 13; // display pin 8, thousands place common cathode
const int digitPins[4] = {7, 8, 12, 13}; //array for digit drive
unsigned char table[] =
{ 0xFC, 0x60, 0xDA, 0xF2, 0x66, 0xFE, 0xF6, 0xEE,
0x3E, 0xB6, 0xBE, 0xE0, 0x9C, 0x7A, 0x9E, 0x83, 0x00
};
/* this table has drivers for digits 0 to F and blank
Element 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Value FC 60 DA F2 66 FE F6 EE 3E B6 BE E0 9C 7A 9E 83 00
Digit 0 1 2 3 4 5 6 7 8 9 A B C D E F (none)
*/
void setup() {
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
}
void Display(unsigned char num, int digitDisplay)
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, table[num]);
digitalWrite(latchPin, HIGH);
digitalWrite(digitPins[digitDisplay], LOW);
for (int k = 0; k < 4; k ++) {
if (k == digitDisplay)
continue; // iterate until k == value of digitDisplay
else
digitalWrite(digitPins[k], HIGH);
}
}
void loop() {
// integerSensor = 222; (I don't know what this is)
Display(2/*integerSensor%10*/, 3);
delay(1);
Display(4/*integerSensor%100*/, 2);
delay(1);
Display(3/*integerSensor % 1000*/, 1);
delay(1);
Display(12, 0);
delay(1);
}
Here's the board layout:



