-
Notifications
You must be signed in to change notification settings - Fork 0
/
macropad.ino
68 lines (64 loc) · 1.33 KB
/
macropad.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
#include <Keyboard.h>
#define Pad1 10 //Kanan bawah
#define Pad2 3
#define Pad3 16
#define Pad4 5
#define Pad5 6 //Kanan Atas
#define Pad6 7
#define Pad7 8
#define Pad8 9
void setup() {
pinMode (Pad1, INPUT_PULLUP);
pinMode (Pad2, INPUT_PULLUP);
pinMode (Pad3, INPUT_PULLUP);
pinMode (Pad4, INPUT_PULLUP);
pinMode (Pad5, INPUT_PULLUP);
pinMode (Pad6, INPUT_PULLUP);
pinMode (Pad7, INPUT_PULLUP);
pinMode (Pad8, INPUT_PULLUP);
Keyboard.begin();
}
//void sendMacroCommand(uint8_t key) {
//Keyboard.press(KEY_LEFT_CTRL);
//Keyboard.press(KEY_LEFT_SHIFT);
//Keyboard.press(KEY_LEFT_ALT);
//Keyboard.press(key);
//}
void loop() {
if (digitalRead(Pad1) == LOW)
{
Keyboard.press(KEY_F5);
delay(300);
Keyboard.press(KEY_RETURN);
}
if (digitalRead(Pad2) == LOW)
{
Keyboard.press(KEY_F2);
}
if (digitalRead(Pad3) == LOW)
{
Keyboard.press(KEY_F3);
}
if (digitalRead(Pad4) == LOW)
{
Keyboard.press(KEY_F4);
}
if (digitalRead(Pad5) == LOW)
{
Keyboard.press(KEY_F5);
}
if (digitalRead(Pad6) == LOW)
{
Keyboard.press(KEY_F6);
}
if (digitalRead(Pad7) == LOW)
{
Keyboard.press(KEY_F7);
}
if (digitalRead(Pad8) == LOW)
{
Keyboard.press(KEY_F8);
}
delay(100);
Keyboard.releaseAll();
}