Smart Home Automation Forum
[Arduino IDE demo source code for KC868-SERVER]--#01-433Mhz-RF-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]--#01-433Mhz-RF-RECEIVE code (/showthread.php?tid=1847)



[Arduino IDE demo source code for KC868-SERVER]--#01-433Mhz-RF-RECEIVE code - KinCony Support - 04-21-2022

Code:
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(digitalPinToInterrupt(13));  //The receive PIN is IO 13
}

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();
  }
}