Serial communication between arduino 33 nano ble and arduino mkrfox 1200

Hello everybody!
I'm using the arduino 33 nano ble for keyword spotting purpose, so i loaded the micro_speech example on it and it works well. Now i'd like to send a message through the serial1 to an arduino mkrfox 1200 when the ble recognizes the keyword "yes", in order to make the mkrfox to send a message to the sigfox network only in this case. I connected the rx, tx and gnd pins on the boards, and i wrote in the sketch some lines to enable the serial1 communication, but it doesn't work.
I setted the nano ble as the trasmitter and the mkrfox as the receiver.
In the nano ble sketch i initialized the serial1 with

Serial1.begin();

then, for the transmission, i wrote this

Serial1.println("yes");

In the mkrfox sketch i wrote this to read the serial1

void loop()
{
   // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  }
....
}

void serialEvent() {
  while (Serial1.available()) {
    // get the new byte:
    char stringa = (char)Serial1.read();
    // add it to the inputString:
    inputString += stringa;
    // if the incoming character is a newline, set a flag so the main loop can
    // do something about it:
    if (stringa == '\n') {
      stringComplete = true;
    }
  }
}

I can't figure out what's wrong.
Thanks in advance for the help

As i can read the code, i cant find out where you called the void, serial event on the loop section. if it doesnt run in the loop section, it doesnt read the Serial, and doesnt do anything within the code.
My question is, is this the full code or just halfway there.
Im asking this because i cant find anything in the loopsection about the serial event handler you wrote.

It's just part of the code.
For the serial event, i copied the code from the SeriaEvent example sketch.

Maybe a stupid question, but baudRate's are set the same? the RX and TX are crossed to one and each other?

yes and yes

My tutorial on Arduino to Arduino/PC
Has very reliable code for sending/receiving between Arduinos complete with circuit diagrams.
It has the advantage that it is very tolerant of delays in the code on either side

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