AdaFruit Metro serial communication to another Metro

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JS123
 
Posts: 28
Joined: Tue Aug 21, 2018 4:55 pm

AdaFruit Metro serial communication to another Metro

Post by JS123 »

I want to send a character array of 10 bytes between 2 Metro boards, these ones to be precise
https://www.adafruit.com/product/2488

I have the character array ready to send. I can output the array to the serial console.

Now comes the fun part. Getting it to send to the second Metro. I connect port 1 TX on the source Metro to port 0 RX on the "slave" Metro.

To send the data I use this inside loop with a delay of 1 second

Code: Select all

  Serial.println("Sending "+String(sendData));
  Serial.write(sendData,10);
I thought this should display "Sending 1234567890" in the serial console window and write the 10 bytes to the TX port? But in my case, both of those commands output to the console Window?

Now on the receiving Arduino I use this code to display the received data inside the loop with a 1 second delay

Code: Select all

  Serial.readBytes(receivedData,10);
  Serial.println("Receieved "+String(receivedData));
I was expecting this to output the sent 10 bytes neatly every 1 second.

Instead it shows "Sending 12". So the master sending Arduino is sending the println output down the TX port 1?

I really want to separate the output to the console vs data I send to the other Arduino.

What am I missing?

I see in other doco that the Arduino Mega and other Arduinos have multiple serial ports with multiple TX/RX ports. Does the Arduino Metro have these same other serial port sets I can use? Or should I just buy 2 Arduino Mega's and use those as the "master" units?

Thanks for any tips helping this newbie.

User avatar
Franklin97355
 
Posts: 23903
Joined: Mon Apr 21, 2008 2:33 pm

Re: AdaFruit Metro serial communication to another Metro

Post by Franklin97355 »

If you plan to connect the two and still be connected to the USB serial you need to set up SoftwareSerial and use that for board to board communications. TX and RX are connected to the USB chip.

User avatar
JS123
 
Posts: 28
Joined: Tue Aug 21, 2018 4:55 pm

Re: AdaFruit Metro serial communication to another Metro

Post by JS123 »

Thanks. I started coding the serial communication and then a little while later got a bad electronics smell and smoke of death from my master arduino somehow. It is dead now. Luckily the rest of my boards and curcuits survivied.

So I am going to have to buy a new Arduino anyway and since the Metros are out of stock I will go with one of the other models that have the multiple TX/RX ports.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”