#include <IRremote.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop(){
if (irrecv.decode(&results)){
Serial.println(results.value, HEX);
irrecv.resume();
}
}
What will if check here and please explain the working also.how if is working?.
Since the & operator is used for the address of that variable. Using it in if statement will always be true as the address will not be 0.
Therefore your Do_somthing() function will always be called.
Edit:
In the edited code & operator is used to pass the address of that variable in the function irrecv.decode().
irrecv.decode(&results)
The above function will return true if a code was received, or false if nothing received yet. When a code is received, information is stored into "results".
For more info: https://www.pjrc.com/teensy/td_libs_IRremote.html