DFRobot MBT0021-EN Руководство - Страница 7
Просмотреть онлайн или скачать pdf Руководство для Робототехника DFRobot MBT0021-EN. DFRobot MBT0021-EN 18 страниц.
Program Link:
https://makecode.microbit.org/_T89YbzEyeF2m
6-3 obstacle Avoidance Robot
The function realized by the following program is: Maqueen Plus detects whether there is an
obstacle in front of it during driving. If there is an obstacle about 30cm ahead, turn to avoid the
obstacle and continue driving.
In the program, the distance read by the ultrasonic is assigned to a variable, and then it is judged
that if the value of this variable is less than 30, the turning action is performed for one second.
After turning for one second, it will continue to detect whether the distance is less than 30cm. If
there are no obstacles 30cm ahead, the car will go straight ahead.
Program Link:
https://makecode.microbit.org/_AR3X7gP4cVim