#include <LiquidCrystal.h>
//#include <BigNumbers.h> // https://github.com/seanauff/BigNumbers/tree/master
#include "BigNumbers.h" // https://github.com/seanauff/BigNumbers/tree/master
const int lcdD7Pin = 10; // LCD D7 pin
const int lcdD6Pin = 11; // LCD D6 pin
const int lcdD5Pin = 12; // LCD D5 pin
const int lcdD4Pin = 13; // LCD D4 pin
const int lcdEPin = 14; // LCD E Pin
const int lcdRSPin = 15; // LCD RS pin
LiquidCrystal lcd(lcdRSPin, lcdEPin, lcdD4Pin, lcdD5Pin, lcdD6Pin, lcdD7Pin);
BigNumbers bigNum(&lcd);
#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'}
};
byte pin_rows[ROW_NUM] = {9, 8, 7, 6}; // connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {5, 4, 3, 2}; // connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
int count = 0;
long acc = 0;
//------------------------------------------------------------------------------
void setup() {
Serial.begin(115200);
lcd.begin(16, 2);
bigNum.begin(); // set up BigNumbers
lcd.clear(); // clear display
}
//------------------------------------------------------------------------------
void loop() {
long key = keypad.getKey();
if (key) {
long convKey;
if (key >= 30 or key <= 39)
{
convKey = key & 0x0F;
acc = acc + convKey;
bigNum.displayLargeInt(acc, 0, 5, false);
acc = acc * 10;
count++;
if(count > 5)
{
lcd.clear(); // clear display
count = 0;
acc = 0;
}
}
}
}