project_mech-keyboard/firmware/keyboard/keyboard.ino
Max Hunt 5aca107cd1 prg
2018-09-27 15:04:08 +01:00

109 lines
2.3 KiB
C++

#include <Keyboard.h>
#include <Keypad.h>
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'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] = {13, 5, 10, 9};
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = {8, 6, 12, 4};
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
#define ledpin 11
void setup() {
Keyboard.begin();
pinMode(ledpin,OUTPUT);
digitalWrite(ledpin, HIGH);
Serial.begin(9600);
}
//funcs:
void fmf1() {}
void fmf2() {}
void fmf3() {}
void fmfky() {Keyboard.print("Fuck You");}
void fmshl() {Keyboard.print("ssh root@192.168.1.999");}
void fmshg() {Keyboard.print("ssh -p 16969 root@225.225.225.999");}
void fmgdr() {Keyboard.print(":/mnt/GIT/gitFolder/");}
void fmezg() {Keyboard.print("ezgit");}//Keyboard.printlnm("ezgit");
void fmsbr() {Keyboard.print("source ~/.bashrc");}
void fmszr() {Keyboard.print("source ~/.zshrc");}
void fmclb() {}
void fmglp() {Keyboard.print("ezgit");}
void fmcbh() {}
void fmcbv() {}
void fmcbs() {}
void fmexr() {}
void loop() {
char key = kpd.getKey();
if(key) {
switch (key) {
case '0':
fmf1();
break;
case '1':
fmf2();
break;
case '2':
fmf3();
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);
}
}