Fix IRremote “It seems, that you are using an old version 2.0 code / example”
IRremote 3+/4.x replaced irrecv.decode(&results) and results.value. Use IrReceiver.begin(), decode() and decodedIRData.command — or the codes you saved won’t match.
Community draft — report a mistake
What you see
libraries\IRremote\src/IRremote.h:12:2: warning: #warning It seems, that you are using an old version 2.0 code / example. [-Wcpp]
libraries\IRremote\src/IRremote.h:13:2: warning: #warning This version is no longer supported! [-Wcpp]
libraries\IRremote\src/IRremote.h:18:2: warning: #warning Or just downgrade your library to version 2.6.0. [-Wcpp]
Sketch uses 6112 bytes (18%) of program storage space. Maximum is 32256 bytes.
--- Serial Monitor ---
Thank you for using the IRremote library!
It seems, that you are using an old version 2.0 code / example.
This version is no longer supported!libraries\IRremote\src/IRremote.h:12:2: warning: #warning It seems, that you are using an old version 2.0 code / example. [-Wcpp] libraries\IRremote\src/IRremote.h:13:2: warning: #warning This version is no longer supported! [-Wcpp] libraries\IRremote\src/IRremote.h:18:2: warning: #warning Or just downgrade your library to version 2.6.0. [-Wcpp] Sketch uses 6112 bytes (18%) of program storage space. Maximum is 32256 bytes. --- Serial Monitor --- Thank you for using the IRremote library! It seems, that you are using an old version 2.0 code / example. This version is no longer supported!
IRremote 3.0 rewrote the receive API, and 4.x keeps only a thin shim for 2.x sketches. The #warning lines (and the banner printed on the Serial Monitor) are the library telling you it is running old-style code that may not match your remote’s codes.
#include <IRremote.hpp>
void setup() {
Serial.begin(9600);
IrReceiver.begin(11, ENABLE_LED_FEEDBACK);
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.command, HEX); // e.g. 45 for button 1
IrReceiver.resume();
}
}Quick fix — try in order
- 1
Include IRremote.hpp and use IrReceiver
#include <IRremote.hpp>, then in setup()IrReceiver.begin(11, ENABLE_LED_FEEDBACK);. NoIRrecv irrecv(11)ordecode_resultsobject. - 2
Read decodedIRData
if (IrReceiver.decode()) { uint8_t cmd = IrReceiver.decodedIRData.command; IrReceiver.resume(); }. - 3
Re-learn your remote’s codes
v4 reports the NEC command byte (e.g. 0x45), not the old 32-bit value (e.g. 0xFFA25D). Print
IrReceiver.printIRResultShort(&Serial);and note the new codes. - 4
Or downgrade for an old project
Library Manager → IRremote → 2.6.0 makes 2.x code work unchanged — the library itself suggests it. Fine for a one-off, not for new projects.
Why it happens
It compiles — why change anything?
The old decode(&results) is kept only as a compatibility shim that fills value with the old MSB-first codes. Many remotes then give different or zero values, so if (results.value == 0xFFA25D) never matches.
results.value is always 0xFFFFFFFF
That was the NEC “repeat” code in v2. v4 sets a repeat flag instead: check IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT.
ESP32 compile errors with old IRremote
IRremote 2.x doesn’t support ESP32 core 3.x. Use 4.x.
Board-specific notes
Arduino Uno: Receiver OUT to pin 11 (or any pin you pass to begin). Project: IR remote relay.
Parts: VS1838B IR receiver — pinout varies between modules; check before powering.
Did this fix it?
Thanks — that helps us keep this page right.