//This library allows you to use the IR reciver
#include "IRremote.h"
//Define IR reciver pin
int IRReciverPin = 15;
//Commands inside void setup run once
void setup()
{
Serial.begin(9600);
IrReceiver.begin(IRReciverPin);
}
//Commands inside void loop run forever
void loop()
{
int irData;
//If data is received
if (IrReceiver.decode())
{
//print to serial monitor
Serial.print("Endereço: ");
Serial.println(IrReceiver.decodedIRData.address, HEX);
Serial.print("Comando: ");
//print the button code
Serial.println(irData = IrReceiver.decodedIRData.command, HEX);
Serial.println(" ");
//Restart and Receive the next value
IrReceiver.resume();
}
}