Motor angle issue

Hi there!

I’ve just started programming my RoboCore. I need to use lego motor mindstorm, example program like motor_simple works perfectly but motor_angle doesn’t work at all.

Link to motor_angle:

What I need to do is:

  • begin at 0 degrees position
  • turn 180 deegrees left
  • go back to 0
  • turn 180 deegrees right

Using only
“hMot3.rotRel(500, 200, false, INFINITE);”
makes my motor rotate forever - no matter what I change in this method.

I tried changing power and time to make my motor turn 180 degrees but it’s not precise at all. Furthermore it deregulates very easily.

I’m looking for help


the simplest possible reason is the broken or incorrect connection of the motor. When the encoder signals don’t come to the RoboCORE controller, the program “thinks” that the motor never reaches the desired position.
To check if the encoder signals work correctly, you can use:

  • ‘hMot3.setPower()’ - to make the motor rotating) and then, independently,
  • ‘hMot3.resetEncoderCnt()’ - to reset encoder counter,
  • and, for example, Serial.printf(“Encoder ticks: %d\r\n”, hMot3.getEncoderCnt()); to read the number of ticks in the loop.


thank you for your answer, I’ll check it as soon as I got my RoboCORE back and I’ll test it.