Use Mega's HardwareSerial with Multiple Devices

Greetings,

I have 32 roboclaws, each controlling 2 motors, that I would like to connect to the same Arduino Mega via Serial1 and Serial2. What would be the best way to do this? I think remember reading somewhere that it's possible to do with diodes and resistors, but I'm confused as to how the correct commands would then reach the correct roboclaw. Do I need a mux to do it, or a bus of some sort?

I'm pretty new at wiring and electronics, but I have plenty of programming experience.

Any input is appreciated! J

See the Serial Mode part of the RoboClaw datasheet. It shows how to wire multiple RoboClaws to a single serial port and use select pins to enable only the units you want to control.

Alternatively you can use RC Mode and treat each RoboClaw as a separate hobby servo.

Actually I was looking for a way to do it in Packet Serial. I figured out it's similar to the way the data sheet describes it for Simple Serial, but the P1-P3 lines are the same line and you put a diode between the line and the roboclaw.

Thanks!