user56037: I am currently working on a keypad door lock mechanism (Similar to this project, Keypad door lock). 
The issues with the code I have is that the keypad attached to my board does not allow me to type the full password. Only the first value displayed on the LCD screen moves but no value is excepted. Also the buttons used to open and close the servo motor do not operate as intended.
Fritzing diagram

Photo of breadboard

Below is the code I currently have:
//LCD config
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);

#include <Servo.h>
#include <Keypad.h>

//Variables
int mot_min = 90;   //min servo angle  (set yours)
int mot_max = 180; //Max servo angle   (set yours)
int character = 0;
int activated = 0;
char Str[16] = {' ', ' ', ' ', ' ', ' ', ' ', '-', '*', '*', '*', ' ', ' ', ' ', ' ', ' ', ' '};
//               0    1    2    3    4    5    6    7    8    9    10   11  12    13   14  15

//Pins
Servo myservo;
int buzzer = 11;   //pin for the buzzer beep
int external = 12; //pin to inside open
int internal = 13; //pin to inside close

//Keypad config
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1', '4', '7', '*'},
  {'2', '5', '8', '0'},
  {'3', '6', '9', '#'},
  {'A', 'B', 'C', 'D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup() {
  myservo.attach(10); //attach the servo to pin D10
  pinMode(buzzer, OUTPUT);
  pinMode(external, INPUT);
  pinMode(internal, INPUT);
  //Init the screen and print the first text
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.print("    PASSWORD");
  lcd.setCursor(0, 1);
  lcd.print("      -***     ");
  //put the servo in the close position first
  myservo.write(mot_min);

}

void loop() {
  ///////////////EMERGENCY OPEN/CLOSE/////////
  if (digitalRead(external) == LOW) // if (digitalRead(external))
  {
    myservo.write(mot_max);
    lcd.clear();
    lcd.setCursor(2, 0);
    lcd.print("INSIDE  OPEN");
    activated = 2;
    analogWrite(buzzer, 240);
    delay(250);
    analogWrite(buzzer, 200);
    delay(250);
    analogWrite(buzzer, 180);
    delay(250);
    analogWrite(buzzer, 250);
    delay(250);
    analogWrite(buzzer, LOW);


    lcd.clear();
    lcd.setCursor(4, 0);
    lcd.print("WELLCOME");

    lcd.setCursor(2, 1);
    lcd.print("ELECTRONOOBS");


    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print("DOOR  OPEN");
    lcd.setCursor(2, 1);
    lcd.print("ELECTRONOOBS");
    delay(500);

  }

  if (digitalRead(internal) == LOW) // if (digitalRead(internal))
  {
    myservo.write(mot_min);
    activated = 0;
    character = 0;
    Str[6] = '-';
    Str[7] = '*';
    Str[8] = '*';
    Str[9] = '*';
    Str[10] = ' ';
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("    PASSWORD");
    lcd.setCursor(0, 1);
    lcd.print(Str);
  }

  ///////////////KEYPAD OPEN/CLOSE////////////
  char customKey = customKeypad.getKey(); //this function reads the presed key

  if (customKey != NULL) { // if (customKey)

    if (character == 0)
    {
      Serial.println(customKey);
      Str[6] = customKey;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("    PASSWORD");
      lcd.setCursor(0, 1);
      lcd.print(Str);

    }

    if (character == 1)
    {
      Serial.println(customKey);
      Str[7] = customKey;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("    PASSWORD");
      lcd.setCursor(0, 1);
      lcd.print(Str);

    }

    if (character == 2) {
      {
        Serial.println(customKey);
        Str[8] = customKey;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }

      if (character == 3)
      {
        Serial.println(customKey);
        Str[9] = customKey;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }

      if (character == 4)
      {
        Serial.println(customKey);
        Str[10] = customKey;
        activated = 1;

      }
      character = character + 1;
    }

    if (activated == 1)
    {
      /*Change your password below!!!
        Change each of Str[6], Str[7], Str[8], Str[9]*/

      // if (Str[10] = 'A' && ...)
      if (Str[10] == 'A' && character == 5 && Str[6] == '3' && Str[7] == '0' && Str[8] == '0' && Str[9] == '7' )
      {
        myservo.write(mot_max);
        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("ACCEPTED");
        activated = 2;
        analogWrite(buzzer, 240);
        delay(250);
        analogWrite(buzzer, 200);
        delay(250);
        analogWrite(buzzer, 180);
        delay(250);
        analogWrite(buzzer, 250);
        delay(250);
        analogWrite(buzzer, LOW);
        delay(1000);

        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("WELLCOME");
        delay(500);
        lcd.setCursor(2, 1);
        lcd.print("ELECTRONOOBS");
        delay(1000);

        lcd.clear();
        lcd.setCursor(3, 0);
        lcd.print("DOOR  OPEN");
        lcd.setCursor(2, 1);
        lcd.print("ELECTRONOOBS");

      }
      else
      {
        lcd.clear();
        lcd.setCursor(1, 0);
        lcd.print("PASSWORD ERROR");
        lcd.setCursor(3, 1);
        lcd.print("TRY  AGAIN");
        analogWrite(buzzer, 150);
        delay(3000);
        analogWrite(buzzer, LOW);
        character = 0;
        Str[6] = '-';
        Str[7] = '*';
        Str[8] = '*';
        Str[9] = '*';
        Str[10] = ' ';
        activated = 0;
        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);
      }
    }
    if (activated == 2)
    {
      if (customKey == 'B' )
      {
        myservo.write(mot_min);
        activated = 0;
        character = 0;
        Str[6] = '-';
        Str[7] = '*';
        Str[8] = '*';
        Str[9] = '*';
        Str[10] = ' ';
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }
    }
  }
}

To re-iterate, With this code now the LCD screen displays PASSWORD but when I enter the password into the keypad only the first number changes value and it does not move to the second value.

user6936: You would appear to have an excess of { here:
if (character ==2) {
{    <<<< Remove this

and then remove the excess } at the end of the code.
It would seem that this is affecting the logic of your code, as you've ended up inadvertently grouping some ifs within another if.

To avoid this type of situation, you need to be much more consistent with your code style (i.e. formatting/indentation). 
Either use:
if (character ==2) {

or 
if (character ==2) 
{

but don't mix them. Otherwise you'll end up in a right old muddle. 
If you keep your coding style consistent, then you'll see, in a flash, something that is out of place - merely by quickly scrolling through the code.

In addition, use the Tools ► Auto Format menu item in the Arduino IDE to correctly format your code and make it easy to read.

56037: <p>I am currently working on a keypad door lock mechanism (Similar to this project, <a href="http://www.electronoobs.com/eng_arduino_tut11.php" rel="nofollow noreferrer">Keypad door lock</a>). </p>

<p>The issues with the code I have is that the keypad attached to my board does not allow me to type the full password. Only the first value displayed on the LCD screen moves but no value is excepted. Also the buttons used to open and close the servo motor do not operate as intended.</p>

<p>Fritzing diagram</p>

<p><a href="https://i.stack.imgur.com/Rk9Wi.png" rel="nofollow noreferrer" title="Fritzing diagram"><img src="https://i.stack.imgur.com/Rk9Wi.png" alt="Fritzing diagram" title="Fritzing diagram"></a></p>

<p>Photo of breadboard</p>

<p><a href="https://i.stack.imgur.com/kzU5p.jpg" rel="nofollow noreferrer" title="Photo of breadboard"><img src="https://i.stack.imgur.com/kzU5p.jpg" alt="Photo of breadboard" title="Photo of breadboard"></a></p>

<p>Below is the code I currently have:</p>

<pre><code>//LCD config
#include &lt;Wire.h&gt;
#include &lt;LiquidCrystal_I2C.h&gt;
LiquidCrystal_I2C lcd(0x27, 20, 4);

#include &lt;Servo.h&gt;
#include &lt;Keypad.h&gt;

//Variables
int mot_min = 90;   //min servo angle  (set yours)
int mot_max = 180; //Max servo angle   (set yours)
int character = 0;
int activated = 0;
char Str[16] = {' ', ' ', ' ', ' ', ' ', ' ', '-', '*', '*', '*', ' ', ' ', ' ', ' ', ' ', ' '};
//               0    1    2    3    4    5    6    7    8    9    10   11  12    13   14  15

//Pins
Servo myservo;
int buzzer = 11;   //pin for the buzzer beep
int external = 12; //pin to inside open
int internal = 13; //pin to inside close

//Keypad config
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1', '4', '7', '*'},
  {'2', '5', '8', '0'},
  {'3', '6', '9', '#'},
  {'A', 'B', 'C', 'D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup() {
  myservo.attach(10); //attach the servo to pin D10
  pinMode(buzzer, OUTPUT);
  pinMode(external, INPUT);
  pinMode(internal, INPUT);
  //Init the screen and print the first text
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.print("    PASSWORD");
  lcd.setCursor(0, 1);
  lcd.print("      -***     ");
  //put the servo in the close position first
  myservo.write(mot_min);

}

void loop() {
  ///////////////EMERGENCY OPEN/CLOSE/////////
  if (digitalRead(external) == LOW) // if (digitalRead(external))
  {
    myservo.write(mot_max);
    lcd.clear();
    lcd.setCursor(2, 0);
    lcd.print("INSIDE  OPEN");
    activated = 2;
    analogWrite(buzzer, 240);
    delay(250);
    analogWrite(buzzer, 200);
    delay(250);
    analogWrite(buzzer, 180);
    delay(250);
    analogWrite(buzzer, 250);
    delay(250);
    analogWrite(buzzer, LOW);


    lcd.clear();
    lcd.setCursor(4, 0);
    lcd.print("WELLCOME");

    lcd.setCursor(2, 1);
    lcd.print("ELECTRONOOBS");


    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print("DOOR  OPEN");
    lcd.setCursor(2, 1);
    lcd.print("ELECTRONOOBS");
    delay(500);

  }

  if (digitalRead(internal) == LOW) // if (digitalRead(internal))
  {
    myservo.write(mot_min);
    activated = 0;
    character = 0;
    Str[6] = '-';
    Str[7] = '*';
    Str[8] = '*';
    Str[9] = '*';
    Str[10] = ' ';
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("    PASSWORD");
    lcd.setCursor(0, 1);
    lcd.print(Str);
  }

  ///////////////KEYPAD OPEN/CLOSE////////////
  char customKey = customKeypad.getKey(); //this function reads the presed key

  if (customKey != NULL) { // if (customKey)

    if (character == 0)
    {
      Serial.println(customKey);
      Str[6] = customKey;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("    PASSWORD");
      lcd.setCursor(0, 1);
      lcd.print(Str);

    }

    if (character == 1)
    {
      Serial.println(customKey);
      Str[7] = customKey;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("    PASSWORD");
      lcd.setCursor(0, 1);
      lcd.print(Str);

    }

    if (character == 2) {
      {
        Serial.println(customKey);
        Str[8] = customKey;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }

      if (character == 3)
      {
        Serial.println(customKey);
        Str[9] = customKey;
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }

      if (character == 4)
      {
        Serial.println(customKey);
        Str[10] = customKey;
        activated = 1;

      }
      character = character + 1;
    }

    if (activated == 1)
    {
      /*Change your password below!!!
        Change each of Str[6], Str[7], Str[8], Str[9]*/

      // if (Str[10] = 'A' &amp;&amp; ...)
      if (Str[10] == 'A' &amp;&amp; character == 5 &amp;&amp; Str[6] == '3' &amp;&amp; Str[7] == '0' &amp;&amp; Str[8] == '0' &amp;&amp; Str[9] == '7' )
      {
        myservo.write(mot_max);
        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("ACCEPTED");
        activated = 2;
        analogWrite(buzzer, 240);
        delay(250);
        analogWrite(buzzer, 200);
        delay(250);
        analogWrite(buzzer, 180);
        delay(250);
        analogWrite(buzzer, 250);
        delay(250);
        analogWrite(buzzer, LOW);
        delay(1000);

        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("WELLCOME");
        delay(500);
        lcd.setCursor(2, 1);
        lcd.print("ELECTRONOOBS");
        delay(1000);

        lcd.clear();
        lcd.setCursor(3, 0);
        lcd.print("DOOR  OPEN");
        lcd.setCursor(2, 1);
        lcd.print("ELECTRONOOBS");

      }
      else
      {
        lcd.clear();
        lcd.setCursor(1, 0);
        lcd.print("PASSWORD ERROR");
        lcd.setCursor(3, 1);
        lcd.print("TRY  AGAIN");
        analogWrite(buzzer, 150);
        delay(3000);
        analogWrite(buzzer, LOW);
        character = 0;
        Str[6] = '-';
        Str[7] = '*';
        Str[8] = '*';
        Str[9] = '*';
        Str[10] = ' ';
        activated = 0;
        lcd.clear();
        lcd.setCursor(4, 0);
        lcd.print("PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);
      }
    }
    if (activated == 2)
    {
      if (customKey == 'B' )
      {
        myservo.write(mot_min);
        activated = 0;
        character = 0;
        Str[6] = '-';
        Str[7] = '*';
        Str[8] = '*';
        Str[9] = '*';
        Str[10] = ' ';
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("    PASSWORD");
        lcd.setCursor(0, 1);
        lcd.print(Str);

      }
    }
  }
}
</code></pre>

<p>To re-iterate, With this code now the LCD screen displays <code>PASSWORD</code> but when I enter the password into the keypad only the first number changes value and it does not move to the second value.</p>
 6936: <p>You would appear to have an excess of <code>{</code> here:</p>

<pre><code>if (character ==2) {
{    &lt;&lt;&lt;&lt; Remove this
</code></pre>

<p>and then remove the excess <code>}</code> at the end of the code.</p>

<p>It would seem that this is affecting the logic of your code, as you've ended up inadvertently grouping some <code>if</code>s within another <code>if</code>.</p>

<hr>

<p>To avoid this type of situation, you need to be much more consistent with your code style (i.e. formatting/indentation). </p>

<p>Either use:</p>

<pre><code>if (character ==2) {
</code></pre>

<p>or </p>

<pre><code>if (character ==2) 
{
</code></pre>

<p>but <em>don't mix them</em>. Otherwise you'll end up in a right old muddle. </p>

<p>If you keep your coding style consistent, then you'll see, in a flash, something that is out of place - merely by quickly scrolling through the code.</p>

<hr>

<p>In addition, use the <code>Tools ► Auto Format</code> menu item in the Arduino IDE to correctly format your code and make it easy to read.</p>
