Hi everybody,
I've wired up a tripple 7-segment LED-digit (EVERLIGHT ELT-541SYGWA/S530-E2/R, Datasheet: ELT-541SYGWA/S530-E2/R pdf, ELT-541SYGWA/S530-E2/R Description, ELT-541SYGWA/S530-E2/R Datasheet, ELT-541SYGWA/S530-E2/R view ::: ALLDATASHEET :::) via one 74HC595N IC to my Arduino Mega 2560 Rev3 and am trying to display numbers using the following code, however, each digit shows the value of the first digit:
#define DIGIT_CLOCK 41
#define DIGIT_LATCH 42
#define DIGIT1_SERDATA 43
int numbers[11] = {119, 36, 107, 110, 60, 94, 95, 100, 127, 126, 128}; // 0...9 + DP
void setup() {
pinMode(DIGIT_LATCH, OUTPUT);
pinMode(DIGIT_CLOCK, OUTPUT);
pinMode(DIGIT_SERDATA, OUTPUT);
}
void loop() {
delay(2000);
displayNumber(1,2,3);
delay(1000);
displayNumber(-1,-1,-1);
}
void displayNumber(int third, int second, int first){
digitalWrite(DIGIT_LATCH, LOW);
if (first >= 0) {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, 0);
} else {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, numbers[first]);
}
if (second >= 0) {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, numbers[second]);
} else {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, 0);
}
if (third >= 0) {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, numbers[third]);
} else {
shiftOut(DIGIT_SERDATA, DIGIT_CLOCK, MSBFIRST, 0);
}
digitalWrite(DIGIT_LATCH, HIGH);
}
What did I miss?
Cheers,
Tobias