user66605: Lack of practice I forgot many function of C & C++...
Can anyone help me with this coding Please...
I think this is The Main coding:
Topic: Gear indicator
I first found this, Gear_Indicator_Raw
But, There was many problem in those sketch,

Those sketches work just like simple counter, 
Can't Show "2" from "0"
No Neutral Detection, 

As Bike Gear, (1 N 2 3 4 5) One Down Four up, I made some Changes,
But can't add the Neutral part smoothly...
And here, My code:
#define BUTTON_DOWN 13
#define BUTTON_UP 4
#define BUTTON_N 11

int ledPinA = 7;
int ledPinB = 12;
int ledPinC = 10;
int ledPinD = 9;
int ledPinE = 8;
int ledPinF = 6;
int ledPinG = 5;

int val_up = 0;
int val_down = 0;
int val_n = 0;
int old_val_n = 0;
int old_val_down = 0;
int old_val_up = 0;
int gear = 0;
// The setup() method runs once, when the sketch starts

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

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

void led0()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, HIGH);
}
void led1()
{
  digitalWrite(ledPinA, HIGH);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, HIGH);
}
void led2()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, HIGH);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, LOW);
}
void led3()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, LOW);
}
void led4()
{
  digitalWrite(ledPinA, HIGH);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led5()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, HIGH);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led6()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, HIGH);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led7()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, HIGH);
}
void led8()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led9()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}

void setLed(int number)
{
  switch (number)
  {
    case 0:  
      led0();
      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;
  }
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void oldloop()
{
  led0();
  led1();
  led2();
  led3();
  led4();
  led5();
  led6();
  led7();
  led8();
  led9();
}

void loop()
{
//neutral

    val_n =  digitalRead(BUTTON_N);
    if ((val_n == HIGH) &&gear<=2)
    {
      gear = 0;                         //Posted wrong "gear = HIGH"
      delay(100);
    }

// Gear Up

    val_up = digitalRead(BUTTON_UP);
    if ((val_up == HIGH) && (old_val_up == LOW) &&(gear<6) && (gear>0))
    {
      gear += 1;
      delay(100);
    }

    else if ((val_up == HIGH) && (old_val_up == LOW) &&(gear==0))
    {
      gear += 2;
      delay(100);
    }
    old_val_up = val_up;

// Gear Down

    val_down = digitalRead(BUTTON_DOWN);
    if ((val_down == HIGH) && (old_val_down == LOW)&& (gear>1))
    {
      gear -= 1;
      delay(100);
    }

    else   if ((val_down == HIGH) && (old_val_down == LOW) && (gear==0))
    {
      gear += 1;
      delay(100);
    }
    old_val_down = val_down;

// Max Limit

    if (gear >= 5)
    {
      gear = 5;
    }

    setLed(gear);
}

The Problem:

Without the "// neutral" part it's work OK, but can't show "0" without reset.
With the "// neutral" part, While gear up, instead of increasing, display shows "0" after "1".
If I press pin "4" very quickly, then it's increasing to Max gear.

I think there is some problem in this part:
//neutral

    val_n =  digitalRead(BUTTON_N);
    if ((val_n == HIGH) &&gear<=2)
    {
     gear = HIGH;
      delay(100);
    }

And, Please, If anyone can tell me about "Void oldloop()", what this is for?

user31105: Likely problem
I'm not sure how to solve the problem, however, I see at least one item that looks strange in the //neutral part:
gear = HIGH;

This seems gear is a pin status (LOW/HIGH), but two lines above:
if ((val_n == HIGH) &&gear<=2)

Here gear is an integer value. This seems quite inconsequent to me.
Pin 4
The reason is you do not have a debouncing algorithm, check for a Debounce Arduino example. When a button is pressed or depressed, it switches sometimes very fast a few times; this might result in multiple increases/decreases of the gear.
oldLoop
The function oldLoop is not used, but if you swap the names of loop and oldLoop you can use the 'test' scenario which is contained in oldLoop.
Some other tips

Use spacing consequently 
You can refactor the LED code a lot.
You can use gear++;  to increase or gear--; to decrease.

Update
(Changed debouncing problem for pin 4).
You changed in your neutral code:
gear = 0;

Shouldn't that be gear = 1;? As gear 1 means Neutral (gear 0 is 1).

user16780: Your problem is that you are confused about the meaning of gear.
One possible meaning could be 0 = neutral, 1 .. 5 = gear. But then, when changing gears you can't simply do + or -,  as the sequence is 1 - 0 - 2 - 3 - ...
The other interpretation is:  gear-- from 2  means neutral and you display something that indicates neutral ( e.g. a '0' or a '-' ) whenever gear==1, and you display a '1' when you do another gear--, and have a numeric value of 0 in gear.
Your decision.

66605: <p>Lack of practice I forgot many function of C &amp; C++...
Can anyone help me with this coding Please...</p>

<p>I think this is The Main coding:
<a href="https://forum.arduino.cc/index.php?topic=103620.0;wap" rel="nofollow noreferrer">Topic: Gear indicator</a></p>

<p>I first found this, <a href="https://github.com/BlueAG/Gear-1/blob/master/Gear_Indicator_Raw/Gear_Indicator_Raw.ino" rel="nofollow noreferrer">Gear_Indicator_Raw</a></p>

<p><strong>But, There was many problem in those sketch,</strong></p>

<ol>
<li>Those sketches work just like simple counter, </li>
<li>Can't Show "2" from "0"</li>
<li>No Neutral Detection, </li>
</ol>

<p>As Bike Gear, (1 N 2 3 4 5) One Down Four up, I made some Changes,
But can't add the Neutral part smoothly...</p>

<p>And here, My code:</p>

<pre><code>#define BUTTON_DOWN 13
#define BUTTON_UP 4
#define BUTTON_N 11

int ledPinA = 7;
int ledPinB = 12;
int ledPinC = 10;
int ledPinD = 9;
int ledPinE = 8;
int ledPinF = 6;
int ledPinG = 5;

int val_up = 0;
int val_down = 0;
int val_n = 0;
int old_val_n = 0;
int old_val_down = 0;
int old_val_up = 0;
int gear = 0;
// The setup() method runs once, when the sketch starts

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

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

void led0()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, HIGH);
}
void led1()
{
  digitalWrite(ledPinA, HIGH);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, HIGH);
}
void led2()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, HIGH);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, LOW);
}
void led3()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, LOW);
}
void led4()
{
  digitalWrite(ledPinA, HIGH);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led5()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, HIGH);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led6()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, HIGH);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led7()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, HIGH);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, HIGH);
  digitalWrite(ledPinG, HIGH);
}
void led8()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, LOW);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}
void led9()
{
  digitalWrite(ledPinA, LOW);
  digitalWrite(ledPinB, LOW);
  digitalWrite(ledPinC, LOW);
  digitalWrite(ledPinD, LOW);
  digitalWrite(ledPinE, HIGH);
  digitalWrite(ledPinF, LOW);
  digitalWrite(ledPinG, LOW);
}

void setLed(int number)
{
  switch (number)
  {
    case 0:  
      led0();
      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;
  }
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void oldloop()
{
  led0();
  led1();
  led2();
  led3();
  led4();
  led5();
  led6();
  led7();
  led8();
  led9();
}

void loop()
{
//neutral

    val_n =  digitalRead(BUTTON_N);
    if ((val_n == HIGH) &amp;&amp;gear&lt;=2)
    {
      gear = 0;                         //Posted wrong "gear = HIGH"
      delay(100);
    }

// Gear Up

    val_up = digitalRead(BUTTON_UP);
    if ((val_up == HIGH) &amp;&amp; (old_val_up == LOW) &amp;&amp;(gear&lt;6) &amp;&amp; (gear&gt;0))
    {
      gear += 1;
      delay(100);
    }

    else if ((val_up == HIGH) &amp;&amp; (old_val_up == LOW) &amp;&amp;(gear==0))
    {
      gear += 2;
      delay(100);
    }
    old_val_up = val_up;

// Gear Down

    val_down = digitalRead(BUTTON_DOWN);
    if ((val_down == HIGH) &amp;&amp; (old_val_down == LOW)&amp;&amp; (gear&gt;1))
    {
      gear -= 1;
      delay(100);
    }

    else   if ((val_down == HIGH) &amp;&amp; (old_val_down == LOW) &amp;&amp; (gear==0))
    {
      gear += 1;
      delay(100);
    }
    old_val_down = val_down;

// Max Limit

    if (gear &gt;= 5)
    {
      gear = 5;
    }

    setLed(gear);
}
</code></pre>

<p><strong>The Problem:</strong></p>

<ol>
<li>Without the "// neutral" part it's work OK, but can't show "0" without reset.</li>
<li>With the "// neutral" part, While <strong>gear up</strong>, instead of increasing, display shows "0" after "1".</li>
<li>If I press pin "4" very quickly, then it's increasing to Max gear.</li>
</ol>

<p>I think there is some problem in this part:</p>

<pre><code>//neutral

    val_n =  digitalRead(BUTTON_N);
    if ((val_n == HIGH) &amp;&amp;gear&lt;=2)
    {
     gear = HIGH;
      delay(100);
    }
</code></pre>

<p>And, Please, If anyone can tell me about "Void oldloop()", what this is for?</p>
 31105: <p><strong>Likely problem</strong></p>

<p>I'm not sure how to solve the problem, however, I see at least one item that looks strange in the //neutral part:</p>

<pre><code>gear = HIGH;
</code></pre>

<p>This seems <code>gear</code> is a pin status (LOW/HIGH), but two lines above:</p>

<pre><code>if ((val_n == HIGH) &amp;&amp;gear&lt;=2)
</code></pre>

<p>Here <code>gear</code> is an integer value. This seems quite inconsequent to me.</p>

<p><strong>Pin 4</strong></p>

<p>The reason is you do not have a debouncing algorithm, check for a Debounce Arduino example. When a button is pressed or depressed, it switches sometimes very fast a few times; this might result in multiple increases/decreases of the gear.</p>

<p><strong>oldLoop</strong></p>

<p>The function <code>oldLoop</code> is not used, but if you swap the names of <code>loop</code> and <code>oldLoop</code> you can use the 'test' scenario which is contained in <code>oldLoop</code>.</p>

<p><strong>Some other tips</strong></p>

<ul>
<li>Use spacing consequently </li>
<li>You can refactor the LED code a lot.</li>
<li>You can use <code>gear++;</code>  to increase or <code>gear--;</code> to decrease.</li>
</ul>

<p><strong>Update</strong></p>

<p>(Changed debouncing problem for pin 4).</p>

<p>You changed in your neutral code:</p>

<pre><code>gear = 0;
</code></pre>

<p>Shouldn't that be <code>gear = 1;</code>? As gear 1 means Neutral (gear 0 is 1).</p>
 16780: <p>Your problem is that you are confused about the meaning of <code>gear</code>.</p>

<p>One possible meaning could be 0 = neutral, 1 .. 5 = gear. But then, when changing gears you can't simply do + or -,  as the sequence is 1 - 0 - 2 - 3 - ...</p>

<p>The other interpretation is:  gear-- from 2  means neutral and you display something that indicates neutral ( e.g. a '0' or a '-' ) whenever gear==1, and you display a '1' when you do another gear--, and have a numeric value of 0 in <code>gear</code>.</p>

<p>Your decision.</p>
