Arduino Roboclaw position control code not working

Questions about using encoders with the Roboclaw product line
Post Reply
Posts: 1
Joined: Fri Feb 28, 2020 5:29 pm

Arduino Roboclaw position control code not working

Post by Sam67 » Fri Feb 28, 2020 11:18 pm

The example in Arduino(Packet Serial Encoder Position) which has SpeedAccelDeccelPositionM1 does not work. I tried out ForwardM1 ,BackwardM1, ReadEncM1, SetEncM1 and ReadSpeedM1 and all these functions work except the SpeedAccelDeccelPositionM1 function. I can't seem to find what the possible issue could be. It would be great if someone points out where the fault is. I am using the default arduino example. Motor is robotzone 12v planetary geared motor and has encoder inbuilt. I tested out two motors and two roboclaws and tried changing baud rate to 9600 and 19200, tried changing values of SpeedAccelDeccelPositionM1. All of them give the same result. Even in the Basic Micro Studio, the position control notch could not be moved up and down. Is it a connection issue or a config issue, cause they motors used to work fine using the same function in my friends project using roboclaw, unfortunately he doesn't have the code or the config with him.

User avatar
Basicmicro Support
Posts: 1335
Joined: Thu Feb 26, 2015 9:45 pm

Re: Arduino Roboclaw position control code not working

Post by Basicmicro Support » Mon Mar 02, 2020 10:13 am

You need to make sure it works in Motion Studio first. Based on your description you have not set a min and max position limit. This means the movement range is 0 so it will not move. Change the min and max position limits to something reasonable and then re-test in Motion studio. Once you get it working in Motion Studio, remember to write the settings to the board(Device menu/Write Settings) and then you should be able to get the example working.

Post Reply