• Home
  • Examples
  • Quadruped Obstacle Avoidance Project with Ultrasonic Sensor

Quadruped Obstacle Avoidance Project with Ultrasonic Sensor

Example Description
Explore the functionality of our obstacle avoidance robot equipped with an ultrasonic sensor. Discover how it intelligently detects obstacles.

Intorduction

This project of obstacle avoidance is for a robot that will move around and look for obstacles. It uses an ultrasonic sensor to measure the distance. If the distance is less than 20 cm, it will stop and look in both directions to see if it can move forward. If it can, it will turn left or right. If not, it will make a U-turn. The robot will also light up an LED display to show where it is going.

Logic

This code is making a robot move around and explore its surroundings. It has an ultrasonic sensor that can measure the distance between objects.

  1. First, it checks if the distance measured by the sensor is less than 20 cm.
  2. If it is, it draws a stop sign pattern on the LED display and makes the robot stop and look straight. Then it looks left and checks if the distance is greater than 40 cm. If it is, it draws a left arrow pattern on the LED display and makes the robot turn left.
  3. If not, it looks right and checks if the distance is greater than 40 cm. If it is, it draws a right arrow pattern on the LED display and makes the robot turn right.
  4. If not, it draws a U arrow pattern on the LED display and makes the robot make a U-turn.
  5. If the distance measured by the ultrasonic sensor is not less than 20 cm, the code will make the robot move forward.

Code

 

 



Upload the code to Quarky and test it.

Output

Table of Contents