Help: Receive RF Transmission using RCSwitch and Arduino Nano Every

Hello, to preface, I am really new to Arduino and just starting to understand some basics. I am currently working on a project where I am trying to receive a 433MHz rf transmission on my Arduino nano every. The code I am using works just fine on my regular Arduino Nano, however I get nothing on the Arduino Nano Every. I think this has to do with the fact that the Every uses a different processor and maybe has different interrupt pins, but I just can't find any good resources on the web.

These are the rf trasmitter and receiver modules I'm using https://www.amazon.com/gp/product/B08H4T2CDQ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1.

I have the Ground and VCC pins going to Arduino Ground and 5V respectively. And one of the data pins I have going to Pin 2 on the Arduino.

The code I'm using is the following:

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0); // Uses interrupt on pin 2 I beleive
  Serial.println("ready");
}

void loop() {
if (mySwitch.available()) {
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.println("");
  }
}

Again, this pin setup and code works just fine on my regular Arduino Nano and my Arduino Uno, but does not work at all on the Nano Every. Is there anything I can do to get this code working on the Every too?

Thank you in advance!

Try this change in syntax

//mySwitch.enableReceive(0); // Uses interrupt on pin 2 I beleive
mySwitch.enableReceive(digitalPinToInterrupt(2));
2 Likes

Yes that fixed it! You are amazing thank you so much!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.