Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
1.Car vertical movement
01.Car vertical movement
01.Car vertical movement1. Learning objectives2. Experimental preparation3. Core code analysis4. Experimental phenomenon
1. Learning objectives
Control the forward and backward movement of the car.
2. Experimental preparation
As shown in the figure below, the motor needs to be connected to the expansion board.

3. Core code analysis
Car direction diagram
q w e
a--丨--d
z x c
McLumk_Wheel_Sports library function required to control the movement of the car:
xmove_forward(speed)
Parameter explanation: Control the car forward
speed: [0,255], the larger the value, the faster the forward speed
Return value: None.
xxxxxxxxxxmove_backward(speed)
Parameter explanation: Control the car to move backward
speed: [0,255], the larger the value, the faster the backward speed
Return value: None.
Source code path: project_demo/04.Car_motion_control
Library path: /home/pi/project_demo/lib
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 blocks run, we can see that the car moves forward for 1 second, moves backward for 1 second, and finally stops.