#include "Segment.h"
#include "Keypad.h"
const int a = 3;
const int b = 4;
const int c = 5;
const int d = 6;
const int e = 7;
const int f = 8;
const int g = 9;
const int dot = 10;
SevenSegmentDisplay display(a, b, c, d, e, f, g, dot);
const byte ROWS = 3;
const byte COLS = 3;
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'}
};
byte rowPins[ROWS] = {14, 15, 16};
byte colPins[COLS] = {18, 19, 20};
Keypad keypad(ROWS, COLS, rowPins, colPins);
void setup() {
Serial.begin(9600);
keypad.begin();
}
void loop() {
char key = keypad.getKey();
if (key != '\0') {
int x = key-'0';
Serial.println(x);
display.displayDigit(x);
delay(100);
}
}