EasyManua.ls Logo

SunFounder 3in1 Kit - Self-Driving Car

Default Icon
351 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder 3in1 Kit
Code
Note:
Open the 8.self_driving_car.ino file under the path of 3in1-kit\car_project\8.self_driving_car.
Or copy this code into Arduino IDE.
Or upload the code through the Arduino Web Editor.
The car will drive freely once the code has been uploaded successfully. When the IR obstruction module on both sides
detects an obstacle, it will move in the opposite direction for emergency evasion; if there is an obstacle within 2~10cm
directly in front of the car, it will back up to the left, adjust its direction, and then move forward.
How it works?
The workflow of this project is as follows.
Priority read the value of left and right IR obstacle avoidance module.
If the left IR module is 0 (obstacle detected), the right IR module is 1, let the car back up to the left.
If the right IR module is 0 (obstacle detected), let the car back up to the right.
If 2 IR modules detect the obstacle at the same time, the car will back up.
5.9. 8. Self-Driving Car 255

Related product manuals