Template: BuildMecar Kit Example
From Waveshare Wiki
About Examples
- Before using the example, please make sure that you have assembled the hardware and set up the software normally.
001-MotorRotation
- About hardware
- The battery is connected to the Buildhat board.
- The Buildhat board is connected to Raspberry Pi.
- Motor is connected to the PORT A of Buildhat.
- Run example
- Open a terminal and run the following command:
sudo python3 ~/BuildMecar-code/001-MotorRotation/MotorRotation.py
- Expected result
The motor which is connected to Buildhat PORT A will run for 1s and then stop.
Please lift the car if the motor doesn't run.
002-MotorSpeedControl
- About hardware
- The battery is connected to the Buildhat board.
- The Buildhat board is connected to Raspberry Pi.
- Motor is connected to the PORT A of Buildhat.
- Run example
- Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/002-MotorSpeedControl/MotorSpeedControl.py
- Expected result
- The motor which is connected to PORT A run and speeds up.
- After touching the max speed, the motor speed down until stops.
- The motor turns in the opposite direction, then speeds up and speeds down in a loop.
003-MultipleMotors
- About hardware
- The battery is connected to the Buildhat board.
- The Buildhat board is connected to Raspberry Pi.
- Motors are connected to the four ports of Buildhat.
- Run example
- Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/003-MultipleMotors/MultipleMotors.py
- Expected result
- The motors run and speed up.
- After touching the max speed, the motors speed down until stop.
- The motors turn in the opposite direction, then speed up and speed down in a loop.
004-WebControl
- Run example
- Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/004-WebControl/WebControl.py
- Expected result
- The IP address is printed in the terminal.
- Open a browse and input the IP with port 5000, for example:
- Press the BUTTON_1 and BUTTON_2, and the corresponding data are printed in the Raspberry Pi terminal.
005-CameraStreamer
- About hardware
- Connect the camera to the Raspberry Pi.
- Run example
- Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/005-CameraStreamer/CameraStreamer.py
- Expected result
- The IP address is printed in the terminal.
- Open a browse and input the IP with port 5000, for example:
- The camera steam is pushed to the webpage.
006-Example
- About hardware
- The BuildMecar should be assembled.
- The camera is connected to the Pi (optional).
- Run example
- The IP address is printed in the terminal.
- Open a browse and input the IP with port 5000, for example:
- Click the buttons to control the BuildMecar.
- If you connect a terminal, the image will be shown on the webpage as well.