File tree 1 file changed +128
-0
lines changed
1 file changed +128
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < IRremote.h>
2
+
3
+ int RECV_PIN = 2 ;
4
+ IRrecv irrecv (RECV_PIN);
5
+ decode_results results;
6
+ char command;
7
+ boolean understood = false ;
8
+
9
+ void setup ()
10
+ {
11
+ Serial.begin (9600 );
12
+ irrecv.enableIRIn (); // Start the receiver
13
+ }
14
+
15
+ void loop () {
16
+ if (irrecv.decode (&results)){
17
+ understood = true ;
18
+ switch (results.value ) {
19
+ case 16738455 :
20
+ command = ' 1' ;
21
+ break ;
22
+ case 16750695 :
23
+ command = ' 2' ;
24
+ break ;
25
+ case 16756815 :
26
+ command = ' 3' ;
27
+ break ;
28
+ case 16724175 :
29
+ command = ' 4' ;
30
+ break ;
31
+ case 16718055 :
32
+ command = ' 5' ;
33
+ break ;
34
+ case 16743045 :
35
+ command = ' 6' ;
36
+ break ;
37
+ case 16716015 :
38
+ command = ' 7' ;
39
+ break ;
40
+ case 16726215 :
41
+ command = ' 8' ;
42
+ break ;
43
+ case 16734885 :
44
+ command = ' 9' ;
45
+ break ;
46
+ case 16730805 :
47
+ command = ' 0' ;
48
+ break ;
49
+ case 16712445 :
50
+ command = ' A' ;
51
+ break ;
52
+ case 16736925 :
53
+ command = ' B' ;
54
+ break ;
55
+ case 16720605 :
56
+ command = ' C' ;
57
+ break ;
58
+ case 16754775 :
59
+ command = ' D' ;
60
+ break ;
61
+ case 16761405 :
62
+ command = ' E' ;
63
+ break ;
64
+ case 16728765 :
65
+ command = ' F' ;
66
+ break ;
67
+ case 16732845 :
68
+ command = ' G' ;
69
+ break ;
70
+
71
+ case 1090494559 :
72
+ command = ' H' ;
73
+ break ;
74
+ case 1090478239 :
75
+ command = ' I' ;
76
+ break ;
77
+ case 1090510879 :
78
+ command = ' J' ;
79
+ break ;
80
+ case 1090490479 :
81
+ command = ' K' ;
82
+ break ;
83
+ case 1090474159 :
84
+ command = ' L' ;
85
+ break ;
86
+ case 1090506799 :
87
+ command = ' M' ;
88
+ break ;
89
+ case 1090498639 :
90
+ command = ' N' ;
91
+ break ;
92
+ case 1090482319 :
93
+ command = ' O' ;
94
+ break ;
95
+ case 1090514959 :
96
+ command = ' P' ;
97
+ break ;
98
+ case 1090472119 :
99
+ command = ' Q' ;
100
+ break ;
101
+ case 1090476199 :
102
+ command = ' R' ;
103
+ break ;
104
+ case 1090463959 :
105
+ command = ' S' ;
106
+ break ;
107
+ case 1090464469 :
108
+ command = ' T' ;
109
+ break ;
110
+ case 1090512919 :
111
+ command = ' U' ;
112
+ break ;
113
+ case 1090497109 :
114
+ command = ' V' ;
115
+ break ;
116
+ case 1090468039 :
117
+ command = ' W' ;
118
+ break ;
119
+ case 1090461919 :
120
+ command = ' X' ;
121
+ break ;
122
+ default :
123
+ understood = false ;
124
+ }
125
+ if (understood == true ) Serial.println (command);
126
+ irrecv.resume (); // Receive the next value
127
+ }
128
+ }
You can’t perform that action at this time.
0 commit comments