07-06-2022, 01:06 AM
[Arduino IDE demo source code for KC868-AI]--#04-KC868-AI_RF receive_code
Code:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup()
{
mySwitch.enableReceive(digitalPinToInterrupt(13));
Serial.begin(115200);
Serial.println();
}
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();
}
delay(30);
}