keypad interfacing

im new to arduino group.
please can anyone help me in reading two digit integer no. from keypad. i hv searched a lot on it but all in vain. none of the codes are working.please please do help me . please.

Can you please post the code that does not work (the complete sketch). Don't forget to put the code inside code tags when you post it so that it does not get mangled. It is much easier to help when there is something to go on.

Have you got any Serial.prints in your code that would give an idea of what is going on, such as input from the keypad ? If so, outputs from then could give clues so please post them too. Details of the keypad and any library code used would also be helpful.

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
int i = 0;
volatile long int digitOne ;
volatile long int digitTwo ;
volatile long int num;
volatile long int digitThree = 0;

char digitOneChar;
char digitTwoChar;
char digitThreeChar;

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] = {11, 10, 9, 8}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  Serial.println("press A to start");
}

void loop(){
  char key = keypad.getKey();

  if (key != NO_KEY){
    switch (key){
      
    case 'A':
      
      digitOne = 0; digitTwo = 0; digitThree = 0 ;  
      Serial.println("-------------------------");
      Serial.println("enter the triggering angle, in 3 digits");
      Serial.println("-------------------------");
      Serial.println("                         ");
      getNumbers();
      break;
      
    
       
     case 'B':
       
           Serial.println("-------------------------");
           Serial.println("the triggering angle confirmed, which is: ");
           Serial.println(num,BYTE);
           Serial.println("-------------------------");
           Serial.println("                         ");
           break;
           
    }   
  }
}

void getNumbers(){
  i = 0;
  char key = keypad.getKey();

  if (key != NO_KEY){
  while ( i <= 3){
        switch (i){
          case 1:
            digitOneChar = key; i++;
            break;
          case 2:
            digitTwoChar = key; i++;
            break;
          case 3:
            digitThreeChar = key; i++;
            break;
          
            
        }
  }
  }
      
        // convert the char to int
        digitOne = digitOneChar - 48;
        digitTwo = digitTwoChar - 48;
        digitThree = digitThreeChar - 48;
        
        //multiplying each digit so as to form a 3 digit number hundreds + tenths + ones
        digitOne = digitOne * 100;
        digitTwo = digitTwo * 10;
        
        // finding the final 3 digit number
        num = digitOne + digitTwo + digitThree;
        
        
           Serial.println("-------------------------");
           Serial.println("3 digits had been entered");
           Serial.println("press B to confirm, or A to enter again");
           Serial.println("-------------------------");
           Serial.println("                         ");
}

Don't forget to put the code inside code tags when you post it so that it does not get mangled.

Hey, you forgot something!

sorry . im new so it happened. il take care next time

il take care next time

Or fix it this time, if you expect anyone to read the code. You can modify posts you have made.

Ya. I have posted it correctly in the code.please. can anyone post the correct code.

  if (key != NO_KEY){
  while ( i <= 3){
        switch (i){
          case 1:
            digitOneChar = key; i++;
            break;
          case 2:
            digitTwoChar = key; i++;
            break;
          case 3:
            digitThreeChar = key; i++;
            break;
        }
  }

If there is a key, execute the while loop, and assign the same key value to all three variables. You have the while loop in the wrong place.

void getNumbers()
{
  i = 0;
  while(i < 3)
  {
     // get a key
     // if there is a key,
     //   assign it the correct variable
  }

  // manipulate the variables to produce a number
}