Hardware requirements:



Online debugging (serial/Bluetooth connection)

Example programs


Script description
Please refer to Example 11 Value of the light sensor.


Knowledge point
Point 1 Ultrasonic sensor introduction
An ultrasonic sensor is like the eyes of mBot, which can let mBot know the distance from an object in front. The ultrasonic sensor measures in cm with preciseness to 1cm and maximum measurable distance to 400cm.

Point 2 Why use  block
To make the value spoken out by the panda easier to read. Here we use  block to show the value. If we do not use the block, you will find the reads on the stage unstable.


Attached–ultrasonic sensor element diagram