Need help on programming please!


Can someone help me please. I would need my mBot to follow a black line and stop at a certain spot for 5 secs and continue following the black line afterwards, if possible I would like it to loop unlimited times. Thanks in advance! Cheers!



With mBlock on PC or with the application mBlockly under IOS ???


How is that “certain spot” marked? A break in the line? Some sign post close to the track? A light beam?


With PC.


The “certain spot” would be somewhere along the black line as the black line would not be break. Sorry if i’m not making any sense as this is my first time using mBot. I would be happy if you have any suggestion on how I can make this work through programming or adjusting the black line.

What my goal is to make a park where there’s a black line in a shape of a circle, and to program the mBot to follow the black line which is to circle around the park, and at a certain point there would be a traffic light and i would like the mBot to stop at that spot for 5secs and continue circling the park afterwards and it goes as a loop. Hope you would understand this explanation, thanks in advance! cheers!



  • mount the traffic light on a thick sign post.
  • let the ultrasonic distance sensor point towards the side of the track with the sign post
  • while following the track, your code should also check if the ultrasonic sensor detects the sign post. If yes, stop, wait 5 seconds, and then go on.
  • Let your code wait until the ultrasonic sensor does not detect anything anymore before you start to look again for the sign post next round.


Hi Oseuka1h,
Here is a mBlock program guide for mBot to you for reference, hope it helps when you write your program.


Alright. thanks a lot mate!


Thanks for the reference link!



I will watch at the end of the week for the 5-second stop. There are many ways to approach the problem. I have some ideas to test before responding.

Line Follower


Hi i would like to hear out the ideas that you have :slight_smile: sorry for the late reply~