Serial Communication Between Me Auriga and Arduino Nano


#1

Hello, I am trying to connect my Me Auriga board to a Arduino Nano using port 5, I have connected them as follows:

MeAuriga | Nano
GND | GND
TX2 | RX0
RX2 | TX1

The Me Auriga is the receiver and the code is here:

char mystr[10]; //Initialized variable to store recieved data

void setup() {
  // Begin the Serial at 9600 Baud
  Serial.begin(9600);
}

void loop() {
  Serial.readBytes(mystr,5); //Read the serial data and store in var
  Serial.println(mystr); //Print data on Serial Monitor
  delay(1000);
}

And the code for the Nano, which is the sender:

   char mystr[5] = "Hello"; //String data

    void setup() {
      // Begin the Serial at 9600 Baud
      Serial.begin(9600);
    }

    void loop() {
      Serial.write(mystr,5); //Write the serial data
      delay(1000);
    }

What Happens:
When I connect them together on the nano, i just get prints of Hello on the serial monitor and it doesn’t matter if the port 5 cable is connected it just keeps printing hello.

While the Me Auriga serial monitor is blank.

What I Have Tried:
I saw this forum, which explains to use serial2, so I try to use serial2 for the Me Auriga but I still get the same output as before.

Any help would be greatly appreciated.


#2

Try using Serial2 on the MeAuriga to receive and Serial to print to your PC. They’re different ports.

https://www.arduino.cc/reference/en/language/functions/communication/serial/

I’m only guessing, but here’s where I’d start:

void setup() {
// Begin the Serial at 9600 Baud
Serial.begin(9600);
Serial2.begin(9600);
}

void loop() {
Serial2.readBytes(mystr,5); //Read the serial data and store in var
Serial.println(mystr); //Print data on Serial Monitor
delay(1000);
}


#3

It’s such a shame that the coding/API documentation for the Ranger is so very very non-existent.


#4

Thank you so much it worked!! Yeah I was searching for any documentation but their was nothing, but thank you for fixing my problem


#5

You’re welcome :slightly_smiling_face: glad to have helped. I’m new to MakeBlock products but have started by creating my own API documentation.
https://docs.google.com/document/d/1EpMWJo9pP2J_pstzXA-XHK8t00Z70SCZYwZ_Kl7VLuw/edit?usp=sharing feel free to share it.


#6

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