I'm experimenting with leJOS and I have ran into a problem: In my program, I want to use the DifferentialPilot together with MotorPort (for a line follower).
But it seems that the DifferentialPilot 'blocks' the motors, even if I call 'stop()' before controlling the motors with MotorPort, so that the motors dont move at all.
- Code: Select all
...
pilot.stop();
while(true) {
if (light.readValue() > 34){
// On white, turn left
LCD.drawString("Turn left", 3, 3);
MotorPort.B.controlMotor(50, 3);
MotorPort.C.controlMotor(100, 1);
} else {
// On black, turn right
LCD.drawString("Turn right", 3, 3);
MotorPort.B.controlMotor(100, 1);
MotorPort.C.controlMotor(50, 3);
}
}
...
From the docs:
An object of this class assumes that it has exclusive control of its motors. If any other object makes calls to its motors, the results are unpredictable.
Is there any way to use them both?
Thank you,
Philipp
