Smart Home Automation Forum
[Arduino IDE demo source code for KC868-SERVER]--#02-IR_RECEIVE code - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1)
+--- Forum: KC868-Server Raspberry Pi4 local server (https://www.kincony.com/forum/forumdisplay.php?fid=17)
+--- Thread: [Arduino IDE demo source code for KC868-SERVER]--#02-IR_RECEIVE code (/showthread.php?tid=1848)



[Arduino IDE demo source code for KC868-SERVER]--#02-IR_RECEIVE code - KinCony Support - 04-21-2022

Code:
#include <IRremote.h>
IRrecv irrecv_22(22);// set ir_receive pin IO22
void setup() {

  Serial.begin(9600);
  irrecv_22.enableIRIn();
}

void loop() {
    if (irrecv_22.decode()) {
      if(irrecv_22.decodedIRData.decodedRawData!=(0)){
        Serial.print("irCode address: ");           
        Serial.println(irrecv_22.decodedIRData.address,HEX);
        Serial.print("irCode command: ");           
        Serial.println(irrecv_22.decodedIRData.command,HEX);
        Serial.print("irCode decodedRawData: ");           
        Serial.println(irrecv_22.decodedIRData.decodedRawData,HEX);
      }
      IrReceiver.resume();
    }
}