I play with two DC precision gear motors purchased from ServoCity today.
Motors works well using the demo code provided by SeeedStudio.
When I tried to control individual motor, motor kept rotating and did not stop.
Here is my code:
delay(5000); //or a variable if you wish
how to stop the motor properly using using SeeedStudio Motor Shield V2?Motor can be stopped when the function motordriver.setSpeed(0,MOTORA) is given. However, the LED indicator showed green, indicating the motor is spinning anticlockwise.
how to stop the motor right after (immediately) giving the stop function? I noticed that the motor has its momentum to keep rotating after completing the delay() function.
Thanks for your help.
Did you try " motordriver.stop(); " instead of "motordriver.stop(MOTORA)" ?
I took a fast look to the library, those commands of goForward, goLeft, gostop is given to control both motors as to control sth like small car or alike. I mean these commands are intentionally build to drive both motors and meaningful only you connect 2 motors.(then car can turn right) I think you need to use motordriver.setSpeed(0, motorlabel) to control 2 motors freely.
As for the turning anticlockwise issue, could it be a reverse pole issue? (+ wire connected to Ground and ground connected to +)?
Or you can drive your motors, just like driving a simple motor, you do not need a library for this. As i see in datasheet, this driver uses L298, so you can drive your motors as you like without any restrictions.
Try this link, and please keep me updated,if you succeeded. (http://tronixlabs.com/news/tutorial-l298n-dual-motor-controller-module-2a-and-arduino/)
For stopping issue, i have heard of sth called braking however i am not sure that it is the thing that you look for. Maybe it would be useful to check.
Thanks for your tip.
I will work on this this week and keep you updated with my progress. : )
I finally have time to play the motor shield.
Here is my testing code to control two motors individually.
I need to specify their speeds and directions using motordriver.setSpeed() and motordriver.rotate(), respectively. And yes. I can stop them using motordriver.setSpeed(0, motorlabel).
Thanks for the link. I don't need the motor library to control two motors. I just need to specify the pin purposes, such as:
int motor_Y_Right = 8;
int motor_Y_Left = 11;
int motor_Y_Speed = 9;
int motor_X_Forward = 12;
int motor_X_Backward = 13;
int motor_X_Speed = 10;
I notice that the motor has different running distance in CLOCKWISE and ANTICLOCKWISE even giving the same delay time. Maybe I should try stepper motors. Any comments??