Template: BuildMecar Kit Example

From Waveshare Wiki
Jump to: navigation, search

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
  1. The motor which is connected to PORT A run and speeds up.
  2. After touching the max speed, the motor speed down until stops.
  3. 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
  1. The motors run and speed up.
  2. After touching the max speed, the motors speed down until stop.
  3. 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.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-02.png
  • 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.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-04.png
  • 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.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-05.png
  • Click the buttons to control the BuildMecar.
  • If you connect a terminal, the image will be shown on the webpage as well.