-
Notifications
You must be signed in to change notification settings - Fork 0
/
DAKboardExtensions.ino
90 lines (81 loc) · 2 KB
/
DAKboardExtensions.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
/*
* The aim of this project is to provide more features
* to the DAKboard. The DAK board is an amazing wifi connected wall
* display for your photos, calendar, news and weather.
* https://dakboard.com
* Yup, I'm cheating. My project is not really an extension.
* I am just finding a way to switch chromium tabs or application
* with an external hardware. Keybord in the mean time.
* More details on github: https://github.com/Antony76
*/
#include "Keyboard.h"
// Test mode is sending the ASCII key number
// pressed on the keyboard
#define TEST_MODE false // true or false
// Map keys to digital inputs
#define KEY_1 0
#define KEY_2 1
#define KEY_3 2
#define KEY_4 3
// Bounce delay
#define BOUNCE 10
#define LOOP_DELAY 300
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pins as outputs.
pinMode(KEY_1, INPUT_PULLUP);
pinMode(KEY_2, INPUT_PULLUP);
pinMode(KEY_3, INPUT_PULLUP);
pinMode(KEY_4, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
// Memo
//KEY_LEFT_CTRL
//KEY_TAB
//KEY_F5 KEY_F11
// Send CTRL+TAB when keyboard key 1 is pressed
if (digitalRead(KEY_1) == LOW)
{
#if TEST_MODE == false
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_TAB);
#else
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(0x31);
#endif
Keyboard.releaseAll();
delay(BOUNCE);
}else if (digitalRead(KEY_2) == LOW)
{
#if TEST_MODE == false
// Not defined yet
#else
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(0x32);
#endif
Keyboard.releaseAll();
delay(BOUNCE);
}else if (digitalRead(KEY_3) == LOW)
{
#if TEST_MODE == false
// Not defined yet
#else
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(0x33);
#endif
Keyboard.releaseAll();
delay(BOUNCE);
}else if (digitalRead(KEY_4) == LOW)
{
#if TEST_MODE == false
// Not defined yet
#else
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(0x34);
#endif
Keyboard.releaseAll();
delay(BOUNCE);
}
delay(LOOP_DELAY);
}