Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(115200);
  Serial.println("\n\nRF Sniffer\n\n");
  
  mySwitch.enableReceive(0);  // Receiver input on interrupt 0 (gpio0GPIO 0)
  pinMode(LED_BUILTIN, OUTPUT); // D13 as output- Optional
}

void loop() {

  

  if (mySwitch.available()) {
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("Bit ");
    Serial.print(" // ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );
    digitalWrite(LED_BUILTIN, HIGH); // Toggle the onboard LED  if serial is available - Optional

    delay(1);

    digitalWrite(LED_BUILTIN, LOW);
    mySwitch.resetAvailable();
  }
}

...