SunFounder PiCar-S
In the line following function, we set the turning angle of the servo in different levels according to the detection results
of the probes. If the line in front of the car is detected as a small curve, then the car will turn a small angle; if it is a big
one, the car will turn a large angle. Thus, here we set four angle-turning constants: a_step, b_step, c_step, and d_step.
When the car moves forward originally, the servo is in 90 degrees. To drive the car to turn left, the servo should be in
90+step degrees; to turn right, the servo should be in 90-step degrees.
There is a special case: if the car runs off the track, and all the probes cannot detect the black lines any more, then it
will continue the program below.
66
Chapter 1. About the PiCar-S
Summary of Contents for PiCar-S
Page 1: ...SunFounder PiCar S www sunfounder com Nov 10 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 8: ...SunFounder PiCar S 4 Chapter 1 About the PiCar S ...
Page 9: ...SunFounder PiCar S 1 1 3 Mechanical Fasteners 1 1 Components List 5 ...
Page 10: ...SunFounder PiCar S 1 1 4 Wires 6 Chapter 1 About the PiCar S ...
Page 11: ...SunFounder PiCar S 1 1 5 PCB 1 1 Components List 7 ...
Page 12: ...SunFounder PiCar S 1 1 6 Other Components 8 Chapter 1 About the PiCar S ...
Page 22: ...SunFounder PiCar S 18 Chapter 1 About the PiCar S ...
Page 26: ...SunFounder PiCar S 22 Chapter 1 About the PiCar S ...
Page 27: ...SunFounder PiCar S 1 4 Circuits Building 1 4 1 Connect the Power 1 4 Circuits Building 23 ...
Page 28: ...SunFounder PiCar S 1 4 2 Connect the Modules 24 Chapter 1 About the PiCar S ...
Page 29: ...SunFounder PiCar S 1 4 3 Connect the Servo 1 4 Circuits Building 25 ...
Page 69: ...SunFounder PiCar S Subflow of Line Following Function 1 8 Arming the Car 65 ...
Page 74: ...SunFounder PiCar S 70 Chapter 1 About the PiCar S ...