#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#include <Keypad.h>
const int ROW_NUM = 4; //four rows
const int COLUMN_NUM = 4; //four columns
char keys[ROW_NUM][COLUMN_NUM] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
int R1 = 1;
int C1 = 1;
int count;
byte pin_rows[ROW_NUM] = {A15, A14, A13, A12}; //connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {A11, A10, A9, A8}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
// #define Single_long_click_duration 10000
char Export[4];
byte a = 0;
void setup() {
lcd.init(); // display initialization
lcd.clear(); // clear the screen fully
lcd.backlight(); // activate the backlight
Export[0] = 0x0; // Set "Export" buffer string to an empty string
}
void loop()
{
lcd.setCursor(C1, R1);
char key = keypad.getKey();
if (key)
{
switch(key)
{
case '0'...'9':
if (C1 < 5)
{
if (C1 < 4)
{
lcd.print(key);
C1++;
Export[a++]=key;
}
}
break;
case 'B':
if(C1>1)
{
C1--;
if (C1 < 1)
C1 = 1;
lcd.setCursor(C1, R1);
lcd.print(' ');
}
break;
case '#':
lcd.setCursor(11, 1);
lcd.print(Export);
a=0;
C1=1;
lcd.setCursor(C1, R1);
lcd.print(" ");
count=Export;
break;
case 'C':
count++;
lcd.setCursor(11,1);
lcd.print(" ");
lcd.setCursor(11,1);
lcd.print(count);
break;
}
}
Here is one of the modified form of a project discussed earlier on this forum only
In above code :
The whole system is a kind of basic counter type system.
The observing area includes case '#': & case 'C': in the code
Here I use to enter a value up to 1 or 2 or 3 digits which gets printed on location (1,1) on LCD (as the dialed value)
and
After pressing key '#'
I get the same entered or dialed value result on the location (11,1)
Here the term Export(a++) is responsible for the complete function
A variable 'count' is defined as we can see in code before setup part . .
I use to make increments of count simply using key 'C' in case 'C': area
Now here comes the actual target :
I just want to equate the value of count with the 'Export[a]' value observed at (11,1)
Reason behind doing this is here :
I want to enter a random dialed single or double or triple digit number and want to start a count from that random dialed number in increasing order
For example =>
Say :
Enter a number '121'
and Enter (#) to display (11,1)
Then By pressing C it will count after '121' like :
122
123
124
125
126
and so on an on . . . . . Like that !!!!
or
Simply =>
Dial '11'
Enter (#)
Display(11,1)
Increment (C)
Result : 12 , 13 , 14 , 15 , so on . . .
Yeah I tried in Case '#' : but that is a complete disaster
Please Help Me getting the target !!!!!!!
Thanks