This commit is contained in:
Max Hunt 2018-09-27 14:14:51 +01:00
parent b5fabe2dca
commit e5ed98bae0

View File

@ -1,23 +1,24 @@
#include <Key.h>
#include <Keypad.h>
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
const byte COLS = 4; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
{'0','1','2','3'},
{'4','5','6','7'},
{'8','9','a','b'},
{'c','d','e','f'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 9, 8, 7, 6 };
byte rowPins[ROWS] = {13, 5, 10, 9};
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 12, 11, 10 };
byte colPins[COLS] = {8, 6, 12, 4};
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
#define ledpin 13
#define ledpin 11
void setup()
{
@ -26,21 +27,83 @@ void setup()
Serial.begin(9600);
}
//funcs:
void fmtky() {}
void fmlol() {}
void fmnws() {}
void fmfky() {}
void fmshl() {}
void fmshg() {}
void fmgdr() {}
void fmezg() {}
void fmsbr() {}
void fmszr() {}
void fmclb() {}
void fmglp() {}
void fmcbh() {}
void fmcbv() {}
void fmcbs() {}
void fmexr() {}
void loop()
{
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
case '*':
digitalWrite(ledpin, LOW);
if(key) {
switch (key) {
case '0':
fmtky();
break;
case '#':
digitalWrite(ledpin, HIGH);
case '1':
fmlol();
break;
case '2':
fmnws();
break;
case '3':
fmfky();
break;
case '4':
fmshl();
break;
case '5':
fmshg();
break;
case '6':
fmgdr();
break;
case '7':
fmezg();
break;
case '8':
fmsbr();
break;
case '9':
fmszr();
break;
case 'a':
fmclb();
break;
case 'b':
fmglp();
break;
case 'c':
fmcbh();
break;
case 'd':
fmcbv();
break;
case 'e':
fmcbs();
break;
case 'f':
fmexr();
break;
default:
Serial.println(key);
}
delay(100);
}
}