#include <IRremote.h>
IRrecv remote(2);
int code; //decode_results code;
#define LED 7
void setup()
{
pinMode(LED, OUTPUT);
Serial.begin(9600);
remote.enableIRIn();
}
void loop()
{
if (remote.decode()) // if (remote.decode(&code))
{
code = remote.decodedIRData.command; // Not needed
Serial.print("irCode: ");
Serial.println(code); // Serial.println(code.value);
if(code==2)
digitalWrite(LED,1);
if(code==152)
digitalWrite(LED,0);
remote.resume();
}
}