//#define DECODE_NEC // Includes Apple and Onkyo. To enable all protocols , just comment/disable this line. #define NEC_P 8 #define IR_RECEIVE_PIN 2 #define LED 7 #include // include the library void setup() { Serial.begin(115200); // Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); Serial.print(F("Ready to receive IR signals of protocols: ")); printActiveIRProtocols(&Serial); pinMode(LED, OUTPUT); } void loop() { /* * Decoded result is in the IrReceiver.decodedIRData structure. */ if (IrReceiver.decode()) { Serial.println("IN"); IrReceiver.resume(); // Early enable receiving of the next IR frame IrReceiver.printIRResultShort(&Serial); IrReceiver.printIRSendUsage(&Serial); Serial.println(); } if(IrReceiver.decodedIRData.command == 0xC){ digitalWrite(LED, HIGH); }else if(IrReceiver.decodedIRData.command == 0x18){ digitalWrite(LED, LOW); } }