Using a 4*4 keypad to enter an integer value I have a 4*4 keypad and I want to use it to enter a number.  I will then use this number as a delay to a LED or a motor to run for the specified time.
This is my sample code:

#include&lt;Keypad.h&gt;
#include&lt;LiquidCrystal.h&gt;
const byte numRows = 4; //number of rows on keypad
const byte numCols = 4; //number of columns on keypad


char keymap[numRows][numCols]= 
{
{'1', '2', '3', 'A'}, 
{'4', '5', '6', 'B'}, 
{'7', '8', '9', 'C'},
{'X', '0', 'Y', 'D'}
};

char value[4]="";
int index = 0;

byte rowPins[numRows] = {22,23,24,25}; //Rows 0 to 3
byte colPins[numCols]= {26,27,28,29}; //Columns 0 to 3

Keypad key= Keypad(makeKeymap(keymap), rowPins, colPins, numRows,numCols);

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
lcd.begin(20,4);

lcd.print("       WELCOME      ");
delay(100);
}

void loop() {
char keypress = key.getKey();
while (keypress != NO_KEY){  
  if (keypress == 'X'){
      lcd.clear();
      for(int j=0;j&lt;=4;j++){
        value[j]=0;
      }
      index=0;
      }
   else if (keypress == 'Y'){
      int amt = atoi(value);
      digitalWrite(13, HIGH);
      delay(amt);
      } 
   else   
      value[index]=keypress;
      index++;
    }  
}


How do I read the value returned by the keypad as an integer?  (When I press 3 I want to read 3 not "3").
You can easily read by this line of code

value = anyDigitFromKeypad - 48


e.g value = "3"-48 = 3