-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_keyboardcode.ino
128 lines (121 loc) · 2.9 KB
/
custom_keyboardcode.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Notes:
// A = CTRL + ALT + SHIFT + F7
// B = CTRL + ALT + SHIFT + F8
// C = CTRL + ALT + SHIFT + F9
// D = CTRL + ALT + SHIFT + F10
// E = CTRL + ALT + SHIFT + F11
// F = CTRL + ALT + SHIFT + F12
#include <Keyboard.h>
int pinA = 8;
int pinB = 9;
int pinC = 10;
int pinD = 11;
int pinE = 12;
int pinF = 13;
int readPinA = 0;
int readPinB = 0;
int readPinC = 0;
int readPinD = 0;
int readPinE = 0;
int readPinF = 0;
void setup() {
pinMode(pinA, INPUT);
pinMode(pinB, INPUT);
pinMode(pinC, INPUT);
pinMode(pinD, INPUT);
pinMode(pinE, INPUT);
pinMode(pinF, INPUT);
// put your setup code here, to run once:
}
void loop() {
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
digitalWrite(pinC, HIGH);
digitalWrite(pinD, HIGH);
digitalWrite(pinE, HIGH);
digitalWrite(pinF, HIGH);
readPinA = digitalRead(pinA);
if (readPinA == 0){
Serial.print("A\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F7);
delay(100);
Keyboard.releaseAll();
delay(250);
}
readPinB = digitalRead(pinB);
if (readPinB == 0){
Serial.print("B\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F8);
delay(100);
Keyboard.releaseAll();
delay(250);
}
readPinC = digitalRead(pinC);
if (readPinC == 0){
Serial.print("C\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F9);
delay(100);
Keyboard.releaseAll();
delay(250);
}
readPinD = digitalRead(pinD);
if (readPinD == 0){
Serial.print("D\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F10);
delay(100);
Keyboard.releaseAll();
delay(250);
}
readPinE = digitalRead(pinE);
if (readPinE == 0){
Serial.print("E\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F11);
delay(100);
Keyboard.releaseAll();
delay(250);
}
readPinF = digitalRead(pinF);
if (readPinF == 0){
Serial.print("F\n");
Keyboard.press(KEY_RIGHT_CTRL);
delay(100);
Keyboard.press(KEY_RIGHT_ALT);
delay(100);
Keyboard.press(KEY_RIGHT_SHIFT);
delay(100);
Keyboard.press(KEY_F12);
delay(100);
Keyboard.releaseAll();
delay(250);
}
}