#include "Segment.h"
#include "Keypad.h"
const int a = 0;
const int b = 1;
const int c = 2;
const int d = 6;
const int e = 3;
const int f = 4;
const int g = 5;
const int dot = 7;
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] = {8, 9, 10};
byte colPins[COLS] = {11, 12, 13};
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);
}
}