Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
4.Servo control (PTZ control)
04. Servo control (PTZ control)
04. Servo control (PTZ control)1. Learning objectives2. Experimental preparation3. Core code analysis4. Experimental phenomenon
1. Learning objectives
Control the servo connected to the expansion board.
2. Experimental preparation
As shown in the figure below, connect the servo to the interface.

3. Core code analysis
Raspbot_Lib library functions needed to control the servo:
Ctrl_Servo(id, angle):
Parameter explanation: Control connected to expansion board S1, S2.
id=1: Control S1 servo, id=2: Control S1 servo.
angle=[0,180], control the rotation angle of the servo
Return value: None.
Source code path: project_demo\03.Basic_car_course
4. Experimental phenomenon
Turn on the robot, open the computer browser to enter the Jupyter lab editor
Enter the source code path and double-click the code to be run

Restart the kernel and clear all outputs

Click the first code block, then click the run button to start running one by one

After the program runs, as the code block runs, we can use the slider to control the angle of the servo