pass elements of global variable array from keypad

I want to pass elements of global variable array a1[2] from keypad. help me pls. here is my code:

#include "Keypad.h"
#include <LiquidCrystal.h>

unsigned int a1[2]={1,10};

const byte Rows= 4;
const byte Cols= 3;

char keymap[Rows][Cols]=
{
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

byte rPins[Rows]= {22,23,24,25};
byte cPins[Cols]= {26,27,28};

Keypad kpd= Keypad(makeKeymap(keymap), rPins, cPins, Rows, Cols);

void setup() {

lcd.begin(16, 2);

lcd.clear();
lcd.setCursor(1,1);1k
lcd.print("Press # to GO");
lcd.setCursor(0,0);
lcd.print("Enter v1: ");
v1 = GetNumber();

}

void loop()
{

...

}

int GetNumber()
{
int num = 0;
char key = kpd.getKey();
while(key != '#')
{
switch (key)
{
case NO_KEY:
break;

case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
lcd.print(key);
//Serial.print(key);
num = num * 10 + (key - '0');
break;

case '*':
num = 0;
lcd.clear();
break;
}

key = kpd.getKey();
}

return num;
}

a1[0] = getNumber();
a1[1] = getNumber();

thanks a lot :)The program is working fine. Now i want to store them in eeprom memory of arduino so that i need not enter these elements every time.

Look at the EEPROM library.

Google is your friend.

I have an arduino program. Every time when the arduino starts it asks to enter certain values using keypad and program starts running until the arduino restarts. But i want to store these key pad values into eeprom of arduino and can be changed only during any requirement to change these values.

#include "Keypad.h"

#include <LiquidCrystal.h>

unsigned int v1;

LiquidCrystal lcd(41, 40, 39, 38, 37, 36);

unsigned int t1[2]={1,v1};

const byte Rows= 4;
const byte Cols= 3;

char keymap[Rows][Cols]=
{
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

byte rPins[Rows]= {22,23,24,25};
byte cPins[Cols]= {26,27,28};

Keypad kpd= Keypad(makeKeymap(keymap), rPins, cPins, Rows, Cols);

void setup() {

lcd.begin(16, 2);

lcd.clear();
lcd.setCursor(1,1);
lcd.print("Press # to GO");
lcd.setCursor(0,0);
lcd.print("Enter v1: ");
v1=GetNumber();
t1[1] = {v1};

}
void loop()
{
timer();
check();

}

void timer()
{
lcd.clear();
lcd.setCursor(2,0);

...

}

void check()
{
...
}

int GetNumber()
{
int num = 0;
char key = kpd.getKey();
while(key != '#')
{
switch (key)
{
case NO_KEY:
break;

case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
lcd.print(key);
//Serial.print(key);
num = num * 10 + (key - '0');
break;

case '*':
num = 0;
lcd.clear();
break;
}

key = kpd.getKey();
}

return num;
}

Look at the EEPROM library.

Google is your friend.

Oh I said this already.