-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfrared_sensor.h
84 lines (77 loc) · 1.72 KB
/
infrared_sensor.h
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
#include "pin_config.h"
#include <IRLibDecodeBase.h>
#include <IRLib_P01_NEC.h>
#include <IRLibCombo.h>
//#include <IRLibRecvPCI.h>//geeft value
#include <IRLibRecv.h>
IRrecv MyReceiver(3); //Create the receiver
IRdecode MyDecoder;
void decodeIr();//declare function
void InfraRedInit() {
MyReceiver.enableIRIn();//start receiving
}
void InfraRedMessage() {
if (MyReceiver.getResults()) {//wait till it returns true
if (MyDecoder.decode()) {
switch (MyDecoder.value) {
case 551496405:
Serial.println("up");
break;
case 551533125:
Serial.println("down");
break;
case 551524965:
Serial.println("left");
break;
case 551500485:
Serial.println("right");
break;
case 551497935:
Serial.println("power");
break;
case 551530575:
Serial.println("open");
break;
default:
Serial.println("unknown");
break;
}
}
MyReceiver.enableIRIn(); //restart the receiver
}
}
void decodeIr(uint32_t irSignal) {
//Yakumo dvd remote codes decimaal
switch (irSignal) {
case 551496405:
Serial.println("up");
break;
case 551533125:
Serial.println("down");
break;
case 551524965:
Serial.println("left");
break;
case 551500485:
Serial.println("right");
break;
case 551497935:
Serial.println("power");
break;
case 551530575:
Serial.println("open");
break;
default:
Serial.println("unknown");
break;
}
}
/* Yakumo codes
up 551496405
down 551533125
left 551524965
right 551500485
power 551497935
open 551530575
enter 4294967295
*/