Welcome to 2DOF PTZ repository
Raspberry Pi tutorials
Instructions for use of 180 degree servo --- Raspberry Pi
1.Raspberry Pi pin diagram

2. Hardware wiring
1.Connect the red wire (positive pole) of the servo to the positive pole of the 7.4V battery 2.Connect the brown wire (negative pole) of the servo to the negative pole of the 7.4V battery 3.The yellow wire (signal wire) of the servo is connected to the physical pin of the Raspberry Pi motherboard (pin 33), BCM code (13) 4.The Raspberry Pi motherboard is powered, and any GND interface on the board is connected to the negative pole of the battery.
3.Upload and run the program
Upload the servo.py file in the folder to the root directory of the Raspberry Pi and enter the following command to run
python servo.py4.Phenomenon
After running the program. The servo will rotate from 0-45-90-135-180-135-90-45-0.