Hi everybody,
I am trying to control one 24-V DC motor by means of RoboClaw 2x7A driver. I am currently using the RoboClaw.h library and the DueTimer.h library for the implementation of a timer in Arduino DUE.
I would like to control the motor in PWM mode (roboclaw.ForwardM2(address,speed_m2); ) and to read data from the encoder (actual_encoder_position = roboclaw.ReadEncM2(address, &status2, &valid2); ) inside the function handled by my timer but it doesn’t work.
If I contol the motor from the void loop() it works but I need to control the motor and read the encoders with a specific frequency.
You can find the code in the attached file.
How can I manage it?
I would appreciate if you could look into this matter as soon as possible.
Thank you very much in advance,
Lorenzo
RoboClaw_DueTimer_ArduinoDUE.ino (1.1 KB)