How to make mbot turn for a specific angle?


How to program the mbot robot so as to make it turn for a specific angle? Such as right turn (or left turn) for 30 degrees, 45 degrees, 90 degrees, or any specific degrees?

I cannot find any block that could let me to input any angle degrees and make it turn?


You could use the compass sensor or 3 axis acceleration sensor for that. Did not try that myself yet.


You’ll have to calculate the time to make the turn. The motors are hobby gearmotors, not stepper motors and use pulse-width modulation (PWM) to control the power level to the motors. There are a couple ways to do that, but the easiest approach will be to have the mBot turn for a set period of time and measure the arc. You can adjust the time from there to get to the proper duration for the turn.

Hope this helps.


Thanks for sharing!


I found how to enable the 3 axis acceleration sensor on mbot here:

That makes it pretty easy to turn to a specific angle.