How to control my mbot after finishing the blackline?


So I am trying to stop my mbot after I finish following the blackline make it walk straight for a little more and than stop it. I tried to do it with line follower using the number 3 that works when the mbot cant find the blackline but it didn`t work.


Hi, can you send me your program uploaded?


i dont actually know how to send you the code cuz im still trying to learn how to use this website.
But if you know any way to do what I asked you would helped me a lot :slight_smile:


Hi, just upload by clicking it and upload it.


mbot.sb2 (75.0 KB)

Hope you can see the codein the way that I send it cuz I couldn`t do it in another way.
If you know any other code that will work please tell and thanks for trying to help me :blush:


Hi esragjik,

If I understand your need correctly: Do you want the Panda sprite to follow a black line until the end of the course ???

Not an mBot? Just a sprite?

I use mblock for robotics but if you use scratch, just take the background. Then we code if it’s your need?
mbot2.sb2 (934,8 Ko)


Hi Crackel,
I want the mbot (not a sprite) to follow the line and at the end of the blackline I want to make the mbot do other things like:
Run foward or stop and set led on board red. I’m just taking these as an example.
If you could help that would mean a lot to me!!!


Hi esragjik,

Sorry, never misunderstood. The mBot can do one execution at a time so you have to think about the logic of the code.

We can start following the lines. Ignore it the best way, but I’ll send you an example tonight. I’m going to leave space in the code for the ultrasonic and we’ll make it more fun.


Hi Crackel, thanks for replying and trying to help me,

I know how to stop the mbot with ultrasonic but I want to stop it without using ultrasonic.

This is just an example that I got to show you want I need.
Example: As in the picture the mbot starts normaly, but at the end it needs to stop only programing it, not getting any help from other things such as barriers (ultrasonic sensor).


I still have to make my way because the 8-shaped path does not meet the need. It’ll take me another night.



I made the code and the path but the lineflower works quite badly. on my journey. It is probably a reflection of the paper. I saw an anti-reflex module on the Makeblock site but I can’t find it anymore.

I’ll be back to you tomorrow.



Sorry for taking your time and thanks a lot for trying to help me!!!
I’m waiting for your response. :blush:


Hi esragjik,

I had some problems with my trip. The mBot is a bit finicky because the black line is not very defined. I will send you the code in two steps.

  • Line tracking and Ultrasonic
  • Stop at the end of the route

If it is possible then we will succeed. I’ll be back in 2 days.


Hi esragjik,

I had to take black tape because the black pencil did not work very well. Conclusion: A good black tape and the mBot follows the path perfectly.


Hi Esragjik,

Without being the perfect solution, here is an example that works well. The secret: The black tape. With a very black line, the mBot no longer has too much difficulty.
Tube - mBot End

I’m sure you can do better with a little work, but if it helps.



I’m sorry but I think I wasn’t clear telling the thing that I want.
In your video the mbot did exactly what I asked for but the programing isn’t very good because I can’t use my remote.
I need to do it only with programing so when the mbot starts to move it will move only with what the programing “said”.

P.S. I know how to program it until the end of the black line, but after that I don’t. And I am using mblock 3 I cannot use any other type of mblcok.

So if you could help me do that it would be very good.
Thank you for your time!!!


Hi esragjik,

It was very clear … The code is 100% autonomous. You can withdraw the IR instructions. It was untile during development. The robot follows the lines, returns to the black line if the turn is too pronounced and stops at the end of the journey. No need for the remote control.

For mBlock 3, I don’t use it but you didn’t replace 4 instructions for the motors and it will work.



Thank you a lot:blush::blush: