this is work..
void loop()
{
switch (keypad.getKey())
{
case '*':
// nom nom nom
but for the next switch, when I press 4 or other key, nothing happen..so I assume that this getKey() not working in switch..
key = keypad.getKey();
if (key != NO_KEY)
{
switch (key)
{
case '1':
i = random(4);
j = random(5);
if ((i<=1 && j<=5) || (i<=4 && j<=1))
{
lcd.setCursor(0,1);
lcd.print("You Choose Add");
delay(2000);
lcd.clear();
lcd.setCursor(1,0);
lcd.print("What is 1+3=");
// when I press 4 or other key, nothing happen..
// so I assume that this getKey() not working in switch..
key = keypad.getKey();
if (key != NO_KEY)
{
if (key == '4')
{
lcd.setCursor(1,0);
lcd.print(key);
delay(2000);
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Great Job!!!");
correct++;
}
else
lcd.print("Sorry.. try again");