#include<Arduino.h> #include"PinDefinitionsAndMore.h" #include<IRremote.hpp> /* * Specify which protocol(s) should be used for decoding. * If no protocol is defined, all protocols (except Bang&Olufsen) are active. * This must be done before the #include <IRremote.hpp>. */ //#define DECODE_DENON // Includes Sharp //#define DECODE_JVC //#define DECODE_KASEIKYO //#define DECODE_PANASONIC // Alias for DECODE_KASEIKYO //#define DECODE_LG #define DECODE_NEC // Includes Apple and Onkyo. To enable all protocols, simply comment/uncomment this line. //#define DECODE_SAMSUNG //#define DECODE_SONY //#define DECODE_RC5 //#define DECODE_RC6 //#define DECODE_BOSEWAVE //#define DECODE_LEGO_PF //#define DECODE_MAGIQUEST //#define DECODE_WHYNTER //#define DECODE_FAST //#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance protocols //#define DECODE_HASH // special decoder for all protocols //#define DECODE_BEO // This protocol must always be activated manually, i.e. it is NOT activated if no protocol is defined. It prevents the decoding of SONY!
//#define DEBUG // Enable this to get lots of nice debug output from the decoders. //#define RAW_BUFFER_LENGTH 750 // 750 is required for remote controls for air conditioning systems. Standard is 200.
voidsetup(){ Serial.begin(115200); while (!Serial) IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); Serial.println(F("KY-022: Infrared receiver test")); Serial.print(F("Ready to receive IR signals from protocols: ")); printActiveIRProtocols(&Serial); Serial.println(F("at the pin "STR(IR_RECEIVE_PIN))); }
voidloop(){ if (IrReceiver.decode()) { if (IrReceiver.decodedIRData.protocol == UNKNOWN) { Serial.println(F("Received noise or an unknown (or not yet activated) protocol")); IrReceiver.printIRResultRawFormatted(&Serial, true); IrReceiver.resume(); } else { IrReceiver.resume(); IrReceiver.printIRResultShort(&Serial); } } }