#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <Keypad.h>
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define DATA_PIN 11
#define CS_PIN 9
#define CLK_PIN 10
char hexaKeys[4][3] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[4] = {8,7,6,5};
byte colPins[3] = {4,3,2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys),rowPins,colPins,4,3);
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
char customKey = 0;
unsigned long total;
byte count = 0;
//----------------------------------------------------------------------
void setup() {
Serial.begin(9600);
myDisplay.begin();
myDisplay.setIntensity(0);
myDisplay.displayClear();
myDisplay.setTextAlignment(PA_CENTER);
}
//----------------------------------------------------------------------
void loop()
{
customKey = customKeypad.getKey();
if (customKey)
{
customKey = customKey;
total = (total * 10) + customKey-48;
myDisplay.print(total);
count++;
if (customKey == '*' || count > 5)
{
myDisplay.displayClear();
customKey = 0;
total = 0;
count = 0;
}
}
}