Skip to main content

07ObstacleAvoidanceCar

Introduction:

Create an obstacle-avoidance car using TabbyBot's ultrasonic sensor.

小车避障

Objectives:

  1. Master the usage of the ultrasonic sensor.
  2. Master the programming logic for the obstacle-avoidance car.

Code:

https://makecode.microbit.org/S18373-61152-77390-63144

Program Logic:

  1. When the ultrasonic sensor detects a distance greater than 15CM, the car moves forward.
  2. When the detected distance is less than 15CM, the car moves backward and then turns.

超声波避障程序

Actual Result:

Press the A button to start the car.