Arduino IR receiver shows that the decode(&results)) function is deprecated

The IR receive shows that the decode(&results)) the function is deprecated and may not work as expected! Simply use decode() without any arguments.

#include <IRremote.h>     // IRremote Library Statement
int RECV_PIN = 11;        //Define the pins of the IR receiver as 11
IRrecv irrecv(RECV_PIN); 
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start receiver
}
void loop() {
  if (irrecv.decode(&results)) 
  {
    Serial.println(results.value, HEX);//Output receive code in hexadecimal newline
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

The new library version is somewhat different from the old one. Most tutorials and examples in the web are outdated. Check the library examples for proper usage of the new library.

You are right, I installed and used a lower version of the IRremoto 2.7.0 library.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.