I am writing a code for arduino mega. I am having problem in defining variables which will be later used in the loop.
The arduinio mega is interfaced with a 4x4 matrix keypad and 20x4 LCD.
The error i am getting is "invalid conversion from 'int*' to 'long int'"
the case 3 and 4 are not yet decided.so i have left it blank.
#include <Keypad.h>
#include <LiquidCrystal.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {30,31,32,33}; //connect to row pinouts
byte colPins[COLS] = {34,35,36,37}; //connect to column pinouts
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
char UL[10];
char LL[10];
int k = 0;
int l = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(20,4);
lcd.cursor();
// set the cursor to column 0, line 0
// (note: line 0 is the first row, since counting begins with 0):
lcd.setCursor(0, 0);
lcd.print("Enter Upper Limit");
lcd.setCursor(0, 1);
}
void loop(){
char key = keypad.getKey();
char range = map(key, UL, LL, 0, 3);
switch(range) {
case 0:
if(k<5) {
if (key != NO_KEY) {
// Print a message to the LCD.
lcd.print(key);
UL[k] = key;
//Serial.println(key);
k++;
}
}
break;
case 1:
if(l<5) {
if (key != NO_KEY) {
// Print a message to the LCD.
lcd.print(key);
LL[l] = key;
// Serial.println(key);
l++;
}
}
case 2:
break;
case 3:
break;
}
}
Please help.. Thanks..