I got a problem with the rotateTo()-method.
What I am doing:
Turning the motors.
Stopping the motors.
Resetting the tachometer with Motor.A.resetTachoMeter().
Turning the motors.
Stopping the motors.
Tell them to go to the ordered position (in my case 0).
The problem is that they just continue spinning around and around.
Exact code of the problem:
- Code: Select all
for (int i = 0;i<3;i++) {m[i].stop();mR[i].stop();}
Button.waitForPress(2000);
if (error == 0) goZero();
- Code: Select all
public static void goZero() { //resets all legs to the original position, called after a shutdown-order
LCD.clear();
LCD.drawString("Starting zeroing!",0,2);
for (int i = 0;i<3;i++){
m[i].setSpeed(40);
m[i].rotateTo(0,true);
mR[i].setSpeed(40);
mR[i].rotateTo(0,true);
}
for (int i = 0;i<3;i++){m[i].waitComplete();mR[i].waitComplete();}
if (m[0].getPosition()== 0 && m[1].getPosition()== 0 && m[2].getPosition() == 0) LCD.drawString("Finished zeroing",0,5);
else LCD.drawString("Couldn't zero!", 0, 5);
Button.waitForPress(2000);
It is supposed to stop in my opinion (API: "if immediateReturn is true, method returns immediately and the motor stops by itself" )
Thanks for any help in advance!!!
