Smart Home Automation Forum
[Arduino IDE demo source code for KC868-A8]--#09-RF SEND - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A8 (https://www.kincony.com/forum/forumdisplay.php?fid=23)
+--- Thread: [Arduino IDE demo source code for KC868-A8]--#09-RF SEND (/showthread.php?tid=1612)



[Arduino IDE demo source code for KC868-A8]--#09-RF SEND - KinCony Support - 01-05-2022

Code 8: //The demo code is RF-send  You can copy the code to your Arduino IDE

Code:
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

  Serial.begin(9600);
 
  // Transmitter is connected to Arduino Pin #2 
  mySwitch.enableTransmit(2);
}

void loop() {

  /* See Example: TypeA_WithDIPSwitches */
  mySwitch.switchOn("11111", "00010");
  delay(1000);
  mySwitch.switchOff("11111", "00010");
  delay(1000);

  /* Same switch as above, but using decimal code */
  mySwitch.send(5393, 24);
  delay(1000); 
  mySwitch.send(5396, 24);
  delay(1000); 

  /* Same switch as above, but using binary code */
  mySwitch.send("000000000001010100010001");
  delay(1000); 
  mySwitch.send("000000000001010100010100");
  delay(1000);

  /* Same switch as above, but tri-state code */
  mySwitch.sendTriState("00000FFF0F0F");
  delay(1000); 
  mySwitch.sendTriState("00000FFF0FF0");
  delay(1000);
}