-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultimediaKeys.ino
More file actions
65 lines (52 loc) · 934 Bytes
/
MultimediaKeys.ino
File metadata and controls
65 lines (52 loc) · 934 Bytes
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
#include <Pushbutton.h>
#define LED_PIN 13
Pushbutton volumeDown(12);
Pushbutton mute(11);
Pushbutton volumeUp(10);
Pushbutton play(9);
Pushbutton next(7);
Pushbutton prev(8);
void setup()
{
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
handshake();
}
void loop()
{
while (1)
{
if (volumeDown.getSingleDebouncedRelease())
{
Serial.write(0x42);
}
if(mute.getSingleDebouncedRelease())
{
Serial.write(0x41);
}
if(volumeUp.getSingleDebouncedRelease())
{
Serial.write(0x43);
}
if(play.getSingleDebouncedRelease())
{
Serial.write(0x44);
}
if(next.getSingleDebouncedRelease())
{
Serial.write(0x45);
}
if(prev.getSingleDebouncedRelease())
{
Serial.write(0x46);
}
}
}
void handshake()
{
while(Serial.available() <= 0)
{
Serial.write('Z');
delay(200);
}
}