arduino program for infrared not working

Thread Starter

denison

Joined Oct 13, 2018
172
Here is the program which I copied exactly;
#include <IRremote.h>
int RECV_PIN = 11; // define input pin on Arduino
IRrecv irrecv(RECV_PIN);
decode_results results; // decode_results class is defined in IRremote.h

void setup() {
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
delay (100); // small delay to prevent reading errors
}

serial monitor gives this message;
'The function decode(&results)) is deprecated and may not work as expected! Just use decode() - without any parameter.' Get this message over and over on serial monitor. The program uploads ok to the nano board.
And this solution also does not work. Anybody suggest what is wrong with the coding.
Can never find the new post button on the Arduino website as I have now told them.
 

ericgibbs

Joined Jan 29, 2010
12,264
hi den,
Using a Nano , I get the same result with if (irrecv.decode(&results)) { , changing to () allows Compiling.
Where did you get the code.

BTW: I had to download the latest version of IRremote.h for the test.

E
 
Top