Smart Home Automation Forum
[Arduino demo source code for KC868-A4]-02 433MHz RF signal receive decode - 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-A4 (https://www.kincony.com/forum/forumdisplay.php?fid=21)
+--- Thread: [Arduino demo source code for KC868-A4]-02 433MHz RF signal receive decode (/showthread.php?tid=1641)



[Arduino demo source code for KC868-A4]-02 433MHz RF signal receive decode - KinCony Support - 01-07-2022

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

Code:
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(digitalPinToInterrupt(19));  //IO19
  Serial.print("begin test");
}

void loop() {
  if (mySwitch.available()) {
   
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );

    mySwitch.resetAvailable();
  }
}