diff --git a/firmware/keyboard/keyboard.ino b/firmware/keyboard/keyboard.ino index d50acce..5dc0a1a 100644 --- a/firmware/keyboard/keyboard.ino +++ b/firmware/keyboard/keyboard.ino @@ -1,46 +1,109 @@ +#include #include 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() { pinMode(ledpin,OUTPUT); digitalWrite(ledpin, HIGH); - Serial.begin(9600); + 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; - default: - Serial.println(key); + 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); } }