WEMOS_Motor_Shield_Arduino_Library icon indicating copy to clipboard operation
WEMOS_Motor_Shield_Arduino_Library copied to clipboard

Library is very slow

Open L0laapk3 opened this issue 8 years ago • 5 comments

If you have a robot, use for example, the following code while driving:

leftMotor.setmotor(_CCW, 0); rightMotor.setmotor(_CCW, 0); The robot will turn the left wheel off first, then delay, and then the right wheel, causing the robot to turn 10-20 degrees left.

This is caused by https://github.com/wemos/WEMOS_Motor_Shield_Arduino_Library/blob/3497cb382ccd724cd2b5c165ad996611e28666f8/src/WEMOS_Motor.cpp#L114 Is there a reason that this delay is here? Whatever the reason is, blocking the entire code for 100 ms is not the solution. I highly recommend removing the delay, it is not appropriate. If there are I²C problems, these must be solved in a different way than this.

L0laapk3 avatar Nov 28 '17 21:11 L0laapk3

Have you tryed to run without it?

fredericplante avatar Jan 10 '18 15:01 fredericplante

I have, and it works, but I would like to see this addressed in the right library.

L0laapk3 avatar Jan 10 '18 16:01 L0laapk3

#5

L0laapk3 avatar Jan 10 '18 16:01 L0laapk3

Might be smart to let a yield(); take the place.

fredericplante avatar Jan 10 '18 16:01 fredericplante

I removed delays

and controll my PS4 BT remote robot in this manner

if(millis()- TmStmpMtrCtrlOld >10){ M_R->setmotor( _CW, oldR2Value>0? (oldR2Value/3+15):0); M_L->setmotor( _CW, oldL2Value>0? (oldL2Value/3+15):0); TmStmpMtrCtrlOld=millis(); }

oleglyan avatar Dec 28 '19 10:12 oleglyan