IRremote
by Armin Joachimsmeyer
IRremote decodes and sends infrared remote-control signals across most common protocols (NEC, Sony SIRC, RC5, Samsung, and many more), using a timer-driven interrupt to capture the precise pulse timings an IR receiver module outputs and match them against known protocol patterns. The catch that trips people up is the major v3/v4 API rewrite: older tutorials use `IRrecv irrecv(PIN); irrecv.decode(&results)`, while current versions use `IrReceiver.begin(PIN)` and `IrReceiver.decode()` with a different results struct — mixing old tutorial code with a newly-installed current version is the most common cause of compile errors people hit with this library.
Installation
Arduino IDE — Library Manager
Sketch → Include Library → Manage Libraries → search IRremote
PlatformIO
lib_deps = arduino-irremote/IRremoteSupported boards
Examples
Receive and print an IR code (current v4.x API)
Uses the current IrReceiver API — older IRrecv-based tutorial code will not compile against this version.
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 2
void setup() {
Serial.begin(9600);
IrReceiver.begin(IR_RECEIVE_PIN);
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
IrReceiver.resume();
}
}