Smart Home Automation Forum
[Arduino IDE demo source code for KC868-SERVER]--#03-IR_send 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]--#03-IR_send code (/showthread.php?tid=1849)



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

Code:
#include <IRremote.h>
IRsend irsend_23(23);      // set ir_send pin IO23
uint8_t sRepeats = 0;

void setup() {

  Serial.begin(9600);
  pinMode(0,INPUT);
  IrSender.begin(23, ENABLE_LED_FEEDBACK);
  IrSender.enableIROut(38);
}

void loop() {
  /*the raw_code of your remote button,you can get it by our
    example [Arduino IDE demo source code for KC868-SERVER]--#02-IR_RECEIVE code*/
        Serial.println("Turn on LED");
        irsend_23.sendNECRaw(0xF807FF00, sRepeats);   //  0xF807FF00  is the raw_code  of led on
        delay(1000);
        Serial.println("Turn off LED");
        irsend_23.sendNECRaw(0xF906FF00, sRepeats);  //   0xF906FF00 is the raw_code  of led Off
        delay(1000);
}
   
This code will turn on LED and delay 1s turn off LED
   
The raw_data of LED on is 0xF807FF00  ,you can decode the data by our example code
"[Arduino IDE demo source code for KC868-SERVER]--#02-IR_RECEIVE code"