Gear indicator

i’ve written a code for a gear indicator (arduino Nano+7 Segment Display) but it doesnt work correctly
Can somebody tell me my Mistake on the code
At first number one should be on the display, but only some single segments appears

#define BUTTON_DOWN 10
#define BUTTON_UP 12

int ledPinA = 6; // LED connected to digital pin 3
int ledPinB = 9; // LED connected to digital pin 4
int ledPinC = 4; // LED connected to digital pin 5
int ledPinD = 3; // LED connected to digital pin 6
int ledPinE = 2; // LED connected to digital pin 7
int ledPinF = 7; // LED connected to digital pin 8
int ledPinG = 8; // LED connected to digital pin 9
int ledPinDP = 5; // LED connected to digital pin 10

int val_down = 0;
int old_val_down = 0;
int val_up = 0;
int old_val_up = 0;
int state = 0;
int gear = 1;

void setup() {
pinMode(BUTTON_DOWN, INPUT);
pinMode(BUTTON_UP, INPUT);

pinMode(ledPinA, OUTPUT);
pinMode(ledPinB, OUTPUT);
pinMode(ledPinC, OUTPUT);
pinMode(ledPinD, OUTPUT);
pinMode(ledPinE, OUTPUT);
pinMode(ledPinF, OUTPUT);
pinMode(ledPinG, OUTPUT);
pinMode(ledPinDP, OUTPUT);

Serial.begin(9600);
}

void led0()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, HIGH);
digitalWrite(ledPinDP, HIGH);
}

void led1()
{
digitalWrite(ledPinA, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, HIGH);
digitalWrite(ledPinDP, HIGH);
}

void led2()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, HIGH);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led3()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led4()
{
digitalWrite(ledPinA, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led5()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led6()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led7()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, HIGH);
digitalWrite(ledPinDP, HIGH);
}

void led8()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void led9()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinDP, HIGH);
}

void ledDP()
{
digitalWrite(ledPinA, HIGH);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinC, HIGH);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, HIGH);
digitalWrite(ledPinDP, LOW);
}

void setLed(int number)
{
switch (number) {
case 0:
ledDP();
break;
case 1:
led1();
break;
case 2:
led2();
break;
case 3:
led3();
break;
case 4:
led4();
break;
case 5:
led5();
break;
case 6:
led6();
break;
case 7:
led7();
break;
case 8:
led8();
break;
case 9:
led9();
break;
}
}

void oldloop()
{
ledDP();
delay(1000); // wait for a second
led0();
delay(1000); // wait for a second
led1();
delay(1000); // wait for a second
led2();
delay(1000); // wait for a second
led3();
delay(1000); // wait for a second
led4();
delay(1000); // wait for a second
led5();
delay(1000); // wait for a second
led6();
delay(1000); // wait for a second
led7();
delay(1000); // wait for a second
led8();
delay(1000); // wait for a second
led9();
delay(1000); // wait for a second
}

void loop()
{
val_up = digitalRead(BUTTON_UP);
if ((val_up == HIGH) && (old_val_up == LOW)) {
gear += 1;
Serial.print("gear number: ");
Serial.println(gear, DEC);
delay(100);
}
old_val_up = val_up;

val_down = digitalRead(BUTTON_DOWN);
if ((val_down == HIGH) && (old_val_down == LOW)) {
gear -= 1;
Serial.print("gear number: ");
Serial.println(gear, DEC);
delay(100);
}
old_val_down = val_down;

if (gear >= 6) {
gear = 6;
}
if (gear <= 1) {
gear = 1;
}

setLed(gear);
}

Could be a hardware problem or a software problem.

Please modify your post. Select all the code, press the icon with the # on it to put tags around the code, and save the changes.

Adding the serial output that you see would help narrow down the hardware/software issue, as would knowing whether oldloop() displayed correct output.

You have

int ledPinA =  6;    // LED connected to digital pin 3
int ledPinB =  9;    // LED connected to digital pin 4
int ledPinC =  4;    // LED connected to digital pin 5
int ledPinD =  3;    // LED connected to digital pin 6
int ledPinE =  2;    // LED connected to digital pin 7
int ledPinF =  7;    // LED connected to digital pin 8
int ledPinG =  8;    // LED connected to digital pin 9
int ledPinDP =  5;   // LED connected to digital pin 10

but the ints don't match the comments. When you're digitalWriting ledPinA, it isn't coming out on D3 - it's coming out on D6.

ok ist that right

int ledPinA = 3; // LED connected to digital pin 3 int ledPinB = 4; // LED connected to digital pin 4 int ledPinC = 5; // LED connected to digital pin 5 int ledPinD = 6; // LED connected to digital pin 6 int ledPinE = 7; // LED connected to digital pin 7 int ledPinF = 8; // LED connected to digital pin 8 int ledPinG = 9; // LED connected to digital pin 9 int ledPinDP = 10; // LED connected to digital pin 10

The convention is:

   A
F     B
   G
E     C
   D

my 7 segment configuration is A=Pin 7 B=Pin 6 C=Pin 4 D=Pin 2 E=Pin 1 F=Pin 9 G=Pin 10 DP=Pin 5 I dont see my mistake,,i am a little bit confused right now :disappointed_relieved:

I dont see my mistake

And we can't see what your problem is, so, we're even.

You might begin by answering the questions in reply #1. And, doing what you were asked to do.

Without contradicting PaulS, I think it might be helpful for you to write a little test 'sketch' to verify your segments are as you expect.

sorry PaulS i dont understand your first replay, can u explain it

Without contradicting PaulS, I think it might be helpful for you to write a little test 'sketch' to verify your segments are as you expect.

That's what oldloop() did. That's why I asked if it worked. No response, though.

sorry PaulS i dont understand your first replay, can u explain it

No. I can't think of any shorter words to use. Nothing in that reply looks complicated to me. Nothing in your reply indicates which of the three paragraphs you didn't understand.

Feel free to volunteer more information that you think we need. That's far better than the 20 questions game you are playing now.

Runaway Pancake thx my mistake was the output to the pins d2-till d8 on the nano THX THX