Skip to content

The tool’s interface below is still in French.

mBot: programming line following

Four sensor states, four decisions to make. Set your logic and watch the virtual robot follow the track.

Ma logique

Capteur : —

Programme


            

Comprendre les quatre valeurs

ValeurCapteur gaucheCapteur droitLe robot est…
0sur le noirsur le noirbien centré sur la ligne
1sur le noirsur le blancdécalé à droite : la ligne est à sa gauche
2sur le blancsur le noirdécalé à gauche : la ligne est à sa droite
3sur le blancsur le blancsorti de la ligne

Sur le vrai robot, le capteur se branche par défaut sur le port 2. La piste doit être une ligne noire mate d’environ 2 cm de large sur fond clair ; réduisez la puissance si le robot décroche dans les virages.

How it works

How to use the line follower simulator

Choose the robot’s action for each of the four sensor values, test your logic on a simulated track and get the program.

  1. Set the logic

    A few parameters are enough.

  2. Run the simulation

    The virtual robot runs your program.

  3. Get the program

    mBlock blocks and Arduino code.

FreeNo subscription, no hidden limits.
No sign-upOpen the page and use the tool. That’s it.
InstantResults in seconds, on mobile too.
PrivateEverything runs in your browser.

About the line follower simulator

The line-follower sensor returns 0, 1, 2 or 3 depending on whether each of its two eyes sees black or white. Following a line comes down to deciding what to do in each case.

Three tracks of increasing difficulty let you check that the logic holds up in tight turns.

mbot line follower mbot line following program mblock line follower mbot simulator mbot line follower code mbot sensor values mblock line following blocks
FAQ

Frequently asked questions about the line follower simulator

What does the value 3 mean?

Both sensors see white: the robot has left the line.

Do I need a robot to use the tool?

No. It exists precisely to prepare or test a program before loading it onto the mBot.

Can it be used in class?

Yes, freely: in middle school technology class, in a robotics club or at home.

Esc
↑ ↓ navigateEnter open