-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDoorbell.ino
49 lines (44 loc) · 818 Bytes
/
Doorbell.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
/*
* Hackers Doorbell
* Joe Rowley
* April, 2017
*/
void setup() {
pinMode(12, INPUT);
Keyboard.begin();
}
void mute() {
Keyboard.press(KEY_MEDIA_MUTE);
Keyboard.release(KEY_MEDIA_MUTE);
}
void pause() {
Keyboard.press(KEY_MEDIA_PLAY_PAUSE);
Keyboard.release(KEY_MEDIA_PLAY_PAUSE);
}
void invert() {
Keyboard.press(KEY_LEFT_GUI); // 'Apple' Key
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press('8');
delay(100);
Keyboard.releaseAll();
}
void flash(int iters) {
for (int i=0; i<iters;i++){
invert();
delay(100);
invert();
delay(100);
}
}
void loop()
{
if (digitalRead(12) != HIGH) {
Serial.println("Button pressed!!!");
pause();
mute();
flash(3);
mute();
}
delay(50);
}