Page 1 of 1

Using multiple roboclaws with an Arduino

Posted: Wed Jul 07, 2021 6:57 am
by vch
So for a project I am working on I am using two 2x7A motor controllers in conjunction with an Arduino Due. Each roboclaw has two motors on it and I have encoders attached for each motor. I've read the tutorial for the standard serial bus operation with arduino tutorial. With that tutorial, it shows how to just run the motors and I would also like to know the speeds. Is there a way for the roboclaw to send the speed information back to the arduino?

I've used the roboclaw library before in the arduino ide, so I know that there is the ReadSpeedM1 or M2 command. My only concern is that this uses the address of the roboclaw, and since both roboclaws are using the same address this command wouldn't work as intended.

Re: Using multiple roboclaws with an Arduino

Posted: Mon Jul 12, 2021 1:31 pm
by Basicmicro Support
For each Roboclaw you will have a unique class object. That object knows which pins are being used to communciate to the specific Roboclaw. So you can safely use the ReadSpeedM# commands. Since you are using 2 physically different serial ports you can use the same packet address for each roboclaw. You will just be using 2 different roboclaw objects.