forked from szabbenjamin/ArduinoIRKodiRemote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIRRemote.ino
More file actions
41 lines (32 loc) · 641 Bytes
/
IRRemote.ino
File metadata and controls
41 lines (32 loc) · 641 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
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int lastkey;
void setup()
{
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
keystroke();
delay(150);
irrecv.resume(); // Receive the next value
}
}
void keystroke() {
int key; // Getted key
double received = results.value; // Received key
// Check repeater code
if (received == 4294967295) {
// It's repeating
key = lastkey;
}
else {
// It's not repeating
key = received;
lastkey = received;
}
Serial.println(key, HEX);
}