# Multiplexing 4 Digit 7 Segment Display!

I am relatively new to Arduino, so do not mind minor mistakes!
I have written the following code to multiplex a 4 digit 7 segment display with my Arduino Uno. Now I have made the mistake, so that when calling the showDigit () function, although the correct numbers are displayed, but not on the mentioned digit from the parameters. The named digit (here the 0 = first digit) turns off and the remaining ones indicate the number. Would anyone have the solution to the problem that when calling showDigit (1,0) on the first digit, the number 1 is used?

const int numeral[10] = {
//ABCDEFG /dp
B11111100, // 0
B01100000, // 1
B11011010, // 2
B11110010, // 3
B01100110, // 4
B10110110, // 5
B00111110, // 6
B11100000, // 7
B11111110, // 8
B11100110, // 9
};
// pins for decimal point and each segment
// DP,G,F,E,D,C,B,A
const int segmentPins[] = { 2,7,4,5,6,3,8,13 };
const int nbrDigits= 4; // the number of digits in the LED display
//dig 0 1 2 3
const int digitPins[nbrDigits] = { 9, 10, 11, 12};
void setup()
{
for(int i=0; i < 8; i++) {
pinMode(segmentPins[i], OUTPUT); // set segment and DP pins to output
}
for(int i=0; i < nbrDigits; i++) {
pinMode(digitPins[i], OUTPUT);
}
}

void loop()
{
showDigit(1,0);
}

void showDigit( int number, int digit)
{
digitalWrite( digitPins[digit], HIGH );
for(int segment = 1; segment < 8; segment++)  {
// isBitSet will be true if given bit is 1
// isBitSet = ! isBitSet; // Code Option*
// uncomment the above Code Option line for common anode display
digitalWrite( segmentPins[segment], isBitSet);
}
delay(5);
digitalWrite( digitPins[digit], LOW );
}

void showNumber( int number)
{
if(number == 0) {
showDigit( 0, nbrDigits-1) ; // display 0 in the rightmost digit
} else {
// display the value corresponding to each digit
// leftmost digit is 0, rightmost is one less than the number of places
for( int digit = nbrDigits-1; digit >= 0; digit--)  {
if(number > 0)  {
showDigit( number % 10, digit) ;
number = number / 10;
}
}
}
}

Vermutlich hast du es so verdrahtet, dass ein Multiplex-Ausgang HIGH sein muss und der andere LOW ?

Dann wäre vermutlich anfangs         digitalWrite( digitPins[digit], LOW );
(und am Ende HIGH ) besser.

If a German response is not what you want, please use a different sub-forum, you're in the German section here.