If you re using Arduino 1.6.0,
new standard libraries named
to make this chapter s examples run. On a Mac you need to delete
RobotIRremote
/Applications/Arduino.app/Contents/Resources/Java/libraries/RobotIRremote/. On a Windows machine,
it's something like
C:\Program Files (x86)\Arduino\libraries\RobotIRremote'.
With the following sketch, you can then decode incoming infrared signals, if
the IRremote library supports their encoding:
RemoteControl/InfraredDumper/InfraredDumper.ino
#include <IRremote.h>
Line 1
-
const unsigned int
-
const unsigned int
-
5
IRrecv ir_receiver(IR_RECEIVER_PIN);
-
decode_results results;
-
-
void
setup() {
-
Serial.begin(BAUD_RATE);
10
ir_receiver.enableIRIn();
-
}
-
-
void dump(const
decode_results* results) {
-
const int
protocol = results->decode_type;
15
Serial.print("Protocol:
-
if
(protocol == UNKNOWN) {
-
Serial.println("not
-
}
else
if
(protocol == NEC) {
-
Serial.println("NEC");
20
}
else if
(protocol == SONY) {
-
Serial.println("SONY");
-
}
else if
(protocol == RC5) {
-
Serial.println("RC5");
-
}
else if
(protocol == RC6) {
25
Serial.println("RC6");
-
}
else if
(protocol == DISH) {
-
Serial.println("DISH");
-
}
else if
(protocol == SHARP) {
-
Serial.println("SHARP");
30
}
else if
(protocol == PANASONIC) {
-
Serial.print("PANASONIC
-
Serial.print("Address:
-
Serial.print(results->panasonicAddress, HEX);
-
Serial.println(")");
35
}
else if
(protocol == JVC) {
-
Serial.println("JVC");
-
}
else if
(protocol == SANYO) {
-
Serial.println("SANYO");
-
}
else if
(protocol == MITSUBISHI) {
40
IRremote
collides with one of the Arduino IDE s
RobotIRremote
IR_RECEIVER_PIN = 11;
BAUD_RATE = 9600;
");
recognized.");
(");
");
www.it-ebooks.info
Grabbing Remote Control Codes
. In this case you have to delete
205
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?