The following code worked perfectly between two Arduino Nanos (both running the same code), but after changing one for a Nano Every it no longer functions properly. The Nano every can still transmit to the standard nano but will not receive anything. I'm not sure what is wrong since the Nano Every is described as needing no changes to existing Nano code.
#include <SoftwareSerial.h>
SoftwareSerial HC12(2,3);
String stringData = "";
bool transmission = false;
void setup() {
Serial.begin(9600);
HC12.begin(9600);
attachInterrupt(digitalPinToInterrupt(2), recievedTransmission, CHANGE);
HC12.print("Initialization Complete");
HC12.print("\n");
}
void loop() {
while (Serial.available()) {
HC12.write(Serial.read());
}
checkTransmission();
delay(100);
}
void recievedTransmission() { //Runs when any transmission is received
while (HC12.available()) {
stringData += char(HC12.read());
}
transmission = true;
}
void checkTransmission() { //Checks received transmission and print to serial
if (transmission == true) {
Serial.println(stringData);
stringData = "";
transmission = false;
}
}