Page tree
Skip to end of metadata
Go to start of metadata

Content

The LEDs switch on

Your mBot contains coloured LEDs, which you can control individually and change their colour.

SensorsActuatorsBlock categoryDifficultyTips
noneColour-LEDsBeginnereasy-

Result: The two color LEDs of the mBot light up red.


Flashing lights

The colour LEDs of the mBot can not only be switched on and off, but you can also change their colour directly without having to switch them off in between.

SensorsActuatorsBlock categoryDifficultyTips
noneColour-LEDsBeginnereasy-

Result: The colour LEDs of the mBot light up alternately red and blue.


Measuring the distance

The mBot has an ultrasonic sensor mounted at the front. This sensor emits sound waves and measures the time they take to return. From this time the sensor can calculate the distance to the next object. We would also like to display this distance. For this we use the block "Show on Serial Monitor ...". "and connect the mBot to the computer via USB so that we can access the Serial Monitor.

SensorsActuatorsBlock categoryDifficultyTips
Ultrasonic sensornoneBeginnereasyHow you access the Serial Monitor is explained here.

Result: The mBot displays the distance to the next item via the Serial Monitor.


Parking sensor

Many cars today already have a parking sensor that measures the distance to the next car or to a wall and emits a warning sound if the distance is too small. We also want to realize this with our mBot. For this we let the mBot drive forward until the distance is smaller than a certain value. In addition, the LEDs light up green until the distance is smaller than the value, then they light up red as a warning.

SensorsActuatorsBlock categoryDifficultyTips
Ultrasonic sensorColour-LEDsBeginnermedium-

Result: The mBot drives straight on until the distance to the next object is less than 15 cm. In addition, the colour LEDs switch from green to red if the distance is less than 15 cm.


Line follower

In this example the mBot should follow a black line. For this we query the two infrared sensors at the front underside of the mBot and correct the course of the mBot if necessary.

SensorsActuatorsBlock categoryDifficultyTips
Infrared sensortwo Motors, one on each sideBeginnermedium-

Result: The mBot follows a black line on the floor.

  • No labels