ADEEPT PiCar-Pro Manual page 173

Table of Contents

Advertisement

3. Place the car on the prepared patrol track.
4. After clicking "AUTO MATIC", the robot will automatically avoid obstacles when
encountering obstacles. .
5. When you want to terminate the Automatic Obstacle Avoidance function, you can
click "AUTO MATIC" again.
14.2.2 The main code program of this lesson
For the complete code, please refer to the file functions.py.
Import dependencies and initialize.
1.
import
time
2.
import
RPi.GPIO as GPIO
3.
import
json
4.
import
Adafruit_PCA9685
5.
6.
pwm = Adafruit_PCA9685.PCA9685()
7.
pwm.set_pwm_freq(50)
8.
9.
Tr = 11
#Pin No. of Ultrasonic Module Input
10.
Ec = 8
# Pin number of the output end of the ultrasonic module
11.
servoPort = 1
12.
servoMiddle = 330
#The number of the servo that controls the horizontal rotation of the ultrasonic module
#The middle position of the servo
170

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PiCar-Pro and is the answer not in the manual?

Table of Contents

Save PDF