Controling LED Brightness with keypad

Hello
I am creating an Arduino sketch that uses a keypad to define the approximated output analog voltage that will light the LED connected to the Arduino on pin 11. This means that by entering a three-digit number into the keypad, you can control the intensity of the LED lighting connected to pin 11 via an Arduino output PWM.

the issue is I am still new and don't know how to make a keypad have more than single input, I have done what I can from what I read but I am stuck

//c++
//
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'},
};
byte rowPins[ROWS] = {7,6,5,4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A3,A2,A1,A0}; //connect to the column pinouts of the keypad

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int value = 0;

void setup(){
  Serial.begin(9600);
  Serial.println("Enter 3 digits");
}

void loop(){
  char key = myKeypad.getKey();              
  if (key != NO_KEY && key != '#'){
    Serial.print(key);   //prints input digit
    for (int i = 3; i != 0; i--) {              //shifts digits to left
     value = value * 10 + key - '0';
     }
  }
     if (key == '#'){                               //prints value 
      Serial.println ();
      Serial.print (value);
      Serial.println ();
      }
      value = 0;
   }

I would really appreciate the help

Take a look at Keypad data entry. A beginners guide - Introductory Tutorials - Arduino Forum

Why the for loop?

    for (int i = 3; i != 0; i--) {              //shifts digits to left
     value = value * 10 + key - '0';
     }

You are resetting value to 0 every time through loop:

value = 0;

Here is a version that checks for a valid entry, translates entered number properly, and displays the converted integer. Then it starts over again:

//c++
//
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'},
};
byte rowPins[ROWS] = {7,6,5,4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A3,A2,A1,A0}; //connect to the column pinouts of the keypad

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int value = 0;

void setup(){
  Serial.begin(9600);
  Serial.println("Enter numeric value followed by #");
}

void loop(){
  char key = myKeypad.getKey();              
  if (key != NO_KEY)
  {
    if (isdigit(key))
    {
      Serial.print(key);
      value = value * 10 + key - '0';
    }
    else if (key == '#')
    {
      Serial.println ();
      Serial.print("Integer value = ");
      Serial.println (value);
      Serial.println("Enter numeric value followed by #");
      value = 0;
    }
  }
}

Thank you that was very helpful

Thank you for the help, I didn't know

can be used that way, I also understand the mistake of for loop.

this is the solution for this question if anyone is interested, feel free to fix it if I did anything wrong.

//c++
//
#include <Keypad.h>
int led=11;

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'},
};
byte rowPins[ROWS] = {7,6,5,4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A3,A2,A1,A0}; //connect to the column pinouts of the keypad

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int value = 0;

void setup(){
  Serial.begin(9600);
  Serial.println("Enter 3 digits followed by #");
}

void loop(){
  char key = myKeypad.getKey();
  if (key != NO_KEY)
  {
    if (isdigit(key))
    {
      //Serial.print(key);
      value = value * 10 + key - '0';
    }
    else if (key == '#')
    {
      /*
      Serial.println ();
      Serial.print("Integer value = ");
      Serial.println (value);
      Serial.println("Enter 3 digits followed by #");
      */
      if (value <= 255){
      digitalWrite(led,value);
      value = 0;
      }
      else {
        digitalWrite(led,LOW);
      	value = 0;
      }
    }
  }
}