MakeBlock - Ultrasonic Sensor


The ultrasonic sensor uses sound to measure distance. The sensor emits a high pitch sound and then listens for the echo (return of the sound). It is then able to tell how far away it is from an object that is directly in front of it. This is similar to how bats use sonar to fly in the dark.


  1. Connect the ultrasonic sensor to the Ranger Brain, using port 6 or one of the other ports on that side.
  2. Copy the sample code and upload it to the robot, test to see that it is working.
  3. Then create your own "younique" code that uses the ultrasonic sensor to do something cool. Can you make it play different sounds depending on the distance it is away from an object? How about light up different lights depending on the distance?


  • the Ultrasonic sensor values are in centimeters and it has a range of 3cm to 400 cm.