8. Parking on its own

Parking on its own

We’ve already programmed our mBot to do all kinds of things on its own. We’ve made it drive by itself, clean up its room, bring drinks...

This time, we’ll teach it how it can park on its own. Search for the perfect spot, and with just one click of the button, the mBot will drive to its spot.

You have 40 minutes to program your robot.

What you'll learn:

  • Programming the buttons on the remote.
  • Look for a different solution depending on the situation.

What you need

STEP 1

Exercise

Before you can start, you need to set the course. We chose to use two mBot boxes to indicate the parking space. But you can use whatever you want.
Challenge a friend.

Who will park their mBot the best? 

To do:

  • Let your mBot drive like you did in lesson 2 or lesson 5.
  • Drive your mBot next to the parking space.
  • Click on a button of your remote and let the mBot park on its own.
  • Click on another button, and your mBot will leave its parking space.
  • You'll have to program the remote yourself. (So you can’t use the standard program)
  • You get 40 minutes to write the program and to optimise it.

STEP 2

Parking in a nutshell

Before you start, we’ll take a second to think about what the mBot has to do to park smoothly. You’ve seen it in the clip already.

  • Drive slightly backwards
  • Turn left
  • Drive slightly backwards
  • Turn right

We’ll show you a few blocks you can use.

blocks

We won’t show the complete code. Tailor your program and above all, test it out!!!

STEP 3

Leaving the parking space

Try to remember what steps your mBot will have to make to drive out of its parking space. 

  • Drive slightly to the left
  • Drive forward
  • Drive slightly to the right

Use the same blocks as in step 2

We won’t show the complete code. Tailor your program and above all, test it out!!!

To complete it, you can let your mBot drive forwards. This way, you can drive next to the parking space. You’ve seen this in lesson 2 en lesson 5.

STEP 4

Extra

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

  • Make the parking space as small as possible. How small can you make it?
  • Park between 2 mBots. If you touch the mBots when parking, their alarms will go off.
  • ...
     

Have fun !!!