Search Code

Lesson 26/31: Smart Car Part 4 : Avoiding Obstacle Using Ultrasonic Sensor | SunFounder Robojax

Lesson 26/31: Smart Car Part 4 : Avoiding Obstacle Using Ultrasonic Sensor | SunFounder Robojax

In this lesson, the fourth in our Smart Car series, we will integrate and utilize an Ultrasonic Sensor in our project. This sensor will enable our smart car to measure distances to objects. We will program the car's behavior based on these measurements: if the detected distance is greater than 25cm, the car will move forward; if it's between 2cm and 10cm, the car will move backward; and if the distance is less than 25cm, the car will come to a stop. We will identify and explain two common errors encountered in the code for this application. Furthermore, the wiring connections and the complete code will be thoroughly explained. Finally, the fully functional project will be demonstrated, showcasing the smart car's ability to react to varying distances.

Images

27-SunFounder-Car-5-Follow-Hand
27-SunFounder-Car-5-Follow-Hand
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_00.09.009
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_00.09.009
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_02.26.146
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_02.26.146
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_00.00.000
26-SunFounder-Car-4-Ultrasonic.mp4_snapshot_00.00.000
899-Lesson 26/31: Avoiding Obstacle Using Ultrasonic Sensor
Language: C++
This code has not been parsed yet. Please return to the admin panel to parse it.

Resources & references

Files📁

Arduino Libraries (zip)