Smart Home Automation Forum

Full Version: [Arduino IDE demo source code for KC868-AG]--#02 433Mhz receive code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code 2: //The demo code is 433Mhz receive code   You can copy the code to your Arduino IDE

Code:
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(digitalPinToInterrupt(13));// IO13  433 RECEIVE PIN
}

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();
  }
}
[attachment=579][attachment=580]