File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Expand file tree Collapse file tree 2 files changed +67
-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+
7+ void setup ()
8+ {
9+ Serial.begin (115200 );
10+ irrecv.blink13 (true );
11+ irrecv.enableIRIn ();
12+ }
13+
14+ void loop () {
15+ if (irrecv.decode (&results)) {
16+ Serial.print (" results value is " );
17+ Serial.print (results.value , HEX);
18+ Serial.print (" , bits is " );
19+ Serial.print (results.bits );
20+ Serial.print (" , decode_type is " );
21+ Serial.println (results.decode_type );
22+ irrecv.resume ();
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ #include < IRremote.h>
2+
3+ IRsend irsend; // Digital Pin 3
4+
5+ void setup ()
6+ {
7+ Serial.begin (115200 );
8+ }
9+
10+ void loop () {
11+ int d;
12+ if ( (d = Serial.read ()) != -1 ) {
13+ unsigned long v = 0x0 ;
14+ switch (d){
15+ case ' 1' :
16+ v = 0x77E14050 ;
17+ break ;
18+ case ' 2' :
19+ v = 0x77E12050 ;
20+ break ;
21+ case ' 3' :
22+ v = 0x77E1D050 ;
23+ break ;
24+ case ' 4' :
25+ v = 0x77E1B050 ;
26+ break ;
27+ case ' 5' :
28+ v = 0x77E1E050 ;
29+ break ;
30+ case ' 6' :
31+ v = 0x77E11050 ;
32+ break ;
33+ }
34+
35+ if (v != 0x0 ){
36+ Serial.print (" read " );
37+ Serial.print (d);
38+ Serial.print (" , IR send " );
39+ Serial.println (v, HEX);
40+ irsend.sendNEC (v, 32 );
41+ }
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments