#include <TM1637Display.h>
#include <Keypad.h>
#define CLK 2
#define DIO 3
const byte ROWS = 4; //four IOWS
const byte COLS = 4; //three columns
//define the cymbols on the buttons of the keypads
char keypadArray[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {4, 5, 6, 7}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 9, 10,11}; //connect to the column pinouts of the keypad
//initialize an instance of the Keypad class
Keypad myKeypad = Keypad(makeKeymap(keypadArray), rowPins, colPins, ROWS, COLS);
//create a 7. Segment Display library intance
TM1637Display display (CLK, DIO);
int keyNum = 0;
void setup() {
display.setBrightness(0x0f);
}
void loop() {
char key = myKeypad.getKey();
int num = key - '0';
if (key) {
Serial.print(key);
if (key == '*') {
for (int key=keyNum;key>=0;key--){
display.showNumberDec(key);}
} else {
if(keyNum<=9999){
keyNum = (keyNum*10) + (int(key)-48);
}
}
if (key == '#'){
keyNum =0;
Serial.print(key);
}
}
display.showNumberDec(keyNum,0);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
sevseg1:CLK
sevseg1:DIO
sevseg1:VCC
sevseg1:GND
keypad1:R1
keypad1:R2
keypad1:R3
keypad1:R4
keypad1:C1
keypad1:C2
keypad1:C3
keypad1:C4