-
Notifications
You must be signed in to change notification settings - Fork 1
/
mech_kb.ino
109 lines (104 loc) · 2.66 KB
/
mech_kb.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
#include <Bounce.h>
Bounce button0 = Bounce(0, 10);
Bounce button1 = Bounce(1, 10); // 10 = 10 ms debounce time
Bounce button2 = Bounce(2, 10); // which is appropriate for
Bounce button3 = Bounce(3, 10); // most mechanical pushbuttons
Bounce button20 = Bounce(20, 10);
Bounce button21 = Bounce(21, 10);
void setup() {
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(20, INPUT_PULLUP);
pinMode(21, INPUT_PULLUP);
}
void loop() {
button0.update();
button1.update();
button2.update();
button3.update();
button20.update();
button21.update();
if (button20.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
Keyboard.set_key1(KEY_ESC);
Keyboard.send_now();
delay(100);
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
}
if (button21.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_LEFT_GUI);
Keyboard.set_key2(KEY_R);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.send_now();
delay(100);
Keyboard.print("firefox fb.com");
delay(100);
Keyboard.set_key2(KEY_ENTER);
Keyboard.send_now();
delay(100);
Keyboard.set_key2(0);
Keyboard.send_now();
}
if (button2.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_LEFT_GUI);
Keyboard.set_key3(KEY_R);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.send_now();
delay(100);
Keyboard.print("firefox youtube.com");
delay(100);
Keyboard.set_key3(KEY_ENTER);
Keyboard.send_now();
delay(100);
Keyboard.set_key3(0);
Keyboard.send_now();
}
if (button3.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_LEFT_GUI);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.send_now();
delay(100);
Keyboard.print("Spot");
delay(100);
Keyboard.set_key4(KEY_ENTER);
Keyboard.send_now();
delay(100);
Keyboard.set_key4(0);
Keyboard.send_now();
}
if (button0.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_LEFT_GUI);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.send_now();
delay(100);
Keyboard.print("Mail");
delay(100);
Keyboard.set_key5(KEY_ENTER);
Keyboard.send_now();
delay(100);
Keyboard.set_key5(0);
Keyboard.send_now();
}
if (button1.risingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_LEFT_GUI);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.send_now();
delay(100);
Keyboard.print("Exec");
delay(100);
Keyboard.set_key6(KEY_ENTER);
Keyboard.send_now();
delay(100);
Keyboard.set_key6(0);
Keyboard.send_now();
}
}