1. First blocks

First blocks

We will learn about the possibilities of the mBot and explore the 3 basic functions of your mBot (playing tones, using LED lights and controlling).

You will learn:

  • To programme the LED lights of the mBot.
  • The basics of the RGB colour system.
  • How to programme the mBot to play music notes.
  • How to programme the mBot to drive forwards and backwards, and to turn left and right.
  • How to programme the mBot engines separately.

Open the mBlock programme on your computer, switch on your mBot and connect it.

PREPERATION

Check the steps in "execute". Answer the following questions:

  • Which steps should I follow?
  • Which steps can I take?
  • How much time do I need?
  • What tools do I need?

Execute

Perform the steps one by one. Have you forgotten how to do it? Look at the hints or download the solution.

STEP 1

Let the light shine

You can programme the two LED lights on the mBot however you like.

Try to build a programme yourself where you make the LEDs shine, make them change colours and make them switch on and off.
 

toelichting

The LED lights are RGB lights. This means “red, green, blue”. You can adjust every colour separately and thus create every colour. A screen uses the same method. You can create every colour on your mBot using a number between 0 and 255. To switch off the LED lights, reset the three colours to zero. Use the block below.

blocks

This is a scheme of all the colours the mBot can make.

RGB kleuren

Can you write a programme in which the mBot describes all the colours? Make it start when you press the space bar.

Can you write a programme in which your mBot becomes a police car with corresponding flashing lights?

Which colours do you need to make that happen? Here is an example, but feel free to improve it!

STEP 2

Playing a tune

The built-in buzzer can play different tones. These are named from C2 (the lowest tone) to D8 (the highest tone).

The next task is to get your mBot to play a tune.

You can play a lot of notes with the mBot. Try out this stave. Press the space bar to play the tune.

do re mi

Well done!

Can you write a programme that plays a birthday tune? The stave looks like this:

muziek verjaardag

STEP 3

A remote-controlled car!

You can make your mBot drive by using the following block:

blocks

This block controls both wheels. You can choose to drive your mBot forwards, backwards, left or right.

You can also choose to control each wheel separately.

blocks

Experiment with these two blocks! Now you can drive your mBot with your computer.

uitdaging

How could you make your mBot run as fast as possible AND on the spot?

 

Well done!

Knowing this, can you write a programme in which you move your mBot by using the arrow keys on your keyboard?

 

REFLECTING

Look back at the project you just made. Ask yourself the following questions:

  • Does the programme work like I expected?
  • What is working well?
  • What is not working well?
  • How can I do things differently?
     

DOWNLOAD

Click on the links below to download the solutions: