7. Ober, een drankje graag

Waiter, a drink

The mBots get to work.
Someone at table 3 calls the waiter for a drink. No problem, the mBot will bring it to the right table.
You have 50 minutes to program your robot.

What you learn:

  • Measure how far an object is removed from the mBot.
  • Send messages to a different mBot.
  • React to different messages from another mBot.

What you need



Before you  can start, you need to set the course.
Use the tape to determine the starting point (the bar). Tape a new line at 30cm, 60cm and 90cm from the starting point.
Put the cup for the second mBot between the starting point and the first line. Make sure to take a look at the drawing of the course.

  • Put the box of the mBot before the first mBot. You can choose where you put the box: line 1, 2 or 3.
  • Press the button on the mBot and let the mBot determine how far the box is standing.
  • Send the information to the second mBot.
  • The second mBot drives forward and takes the cup with him.
  • He drops it right next to the box.


The first mBot: measuring

First, we need to know the distance at which the box is located. We’ll need to measure it 3 times.
The mBot can determine it for us. We have made a variable for this.

Use these blocks.


You don’t have to install this program on your mBot. If you connect the cable to your mBot, the distances will constantly be sent to you. You can read the distance on the upper left side of your screen.



Now measure the three different distances at which you can place the box. Write down the distances so you can use them again later.


The first mBot, sending data

Now that you know the distances at which the boxes are, you can prepare everything to send the data to the second mBot.
Delete all the blocks from your sphere of action and add these.


If you click on the built-in button, we’ll measure the distance and send the data.
Drag these blocks into your sphere of action. We use these blocks to send the distance of the first line.


Because the distance can sometimes change, we use the “and-function”.
The distance is bigger than 20 and smaller than 30.

Apply this technique for the other distances. If you’ve measured different values, make sure to adapt them.


The second mBot, driving

Your first mBot sends the data. Nice job. In this step, we’ll program the second mBot to receive the data.
Drag these blocks into your sphere of action.


Try to fit them together. If you receive the message = 1, the mBot should do something.

The movement the mBot will have to make has to be in the If/Then-function. We chose to make the mBot:

  • Drive forward,
    • Stop
    • Wait
    • Return to the starting point.

This is only for message 1. Do the same for the other messages. Make sure to adapt the program if your mBot doesn’t stop on, or return to the correct spot.



You can add as many assignments as you’d like. We’ll list a few, but try to use your imagination.

  • Make multiple mBots react to the messages.
  • Add lights and sounds when you drop off the drink.
  • Let it complete a difficult course.
  • Make the mBots clean up.
  • ...


Have fun !!!