Skip to content

Commit da555a9

Browse files
authored
Create IrTest.ino
1 parent 1464f35 commit da555a9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

IrTest.ino

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
You can use this sketch to get codes from your IR remote control.
3+
Code are send to Serial Port. IR receiver is connect to pin D7
4+
External library IRremote is required (https://github.com/z3t0/Arduino-IRremote)
5+
*/
6+
7+
#include <IRremote.h>
8+
9+
//IR REMOTE CONTROL
10+
int receirerPin = 7; //Arduino pin connected to IR receiver
11+
IRrecv irReceiver(receirerPin);
12+
decode_results irResults;
13+
14+
void setup()
15+
{
16+
Serial.begin(9600); //start serial communication
17+
irReceiver.enableIRIn(); // start the IR receiver
18+
}
19+
20+
void loop() {
21+
if (irReceiver.decode(&irResults)) {
22+
Serial.println(irResults.value, HEX); //send data to PC
23+
irReceiver.resume(); // Receive next value
24+
}
25+
delay(100); //some small delay
26+
}

0 commit comments

Comments
 (0)