Tutorial
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Assembly and Precautions
- 5 Controlling Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 How to Control DC Motor
- 12 Ultrasonic Module
- 13 Line Tracking
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Automatic Obstacle Avoidance
- 17 Why OpenCV Uses Multi-threading to Process Vide
- 18 OpenCV Learn to Use OpenCV
- 19 Using OpenCV to Realize Color Recognition and T
- 20 Machine Line Tracking Based on OpenCV
- 21 Create A WiFi Hotspot on The Raspberry Pi
- 22 Install GUI Dependent Item under Window
- 23 How to Use GUI
- 24 Control The WS2812 LED via GUI
- 25 Real-time Video Transmission Based on OpenCV
- 26 Use OpenCV to Process Video Frames on The PC
- 27 Enable UART
- 28 Control Your AWR with An Android Device
- Conclusion
69
Control A and B motors to rotate at full speed for 3 seconds
'''
motor_A(1, 100)
motor_B(1, 100)
time.sleep(3)
'''
Control A and B motors to rotate in opposite directions at full speed for 3 seconds
'''
motor_A(-1, 100)
motor_B(-1, 100)
time.sleep(3)
'''
Stop the motor rotation of A and B ports
'''
motorStop()
●The above codes can be used to control the motor movement. The structure of the two functions motor_A and
motor_B is the same, but the control servo port is different. This function requires two parameters, one is the direction
and the other is the speed. 1 or -1. The minimum speed is 0 and the maximum value is 100. Since the speed adjustment
is adjusted by PWM, it is actually equivalent to adjusting the voltage value of the motor port. The motor has a
deceleration mechanism as a load. There will be no rotation, so the speed value should not be too low.
●According to the actual situation, changing the speed value of the robot driven by the motor will only make the
robots starting speed slower, which has little effect on the maximum speed, and when the given speed is too low, it will
cause the motor to stall.
The above codes can be used to control the motor movement. The structure of the two functions motor_A and
motor_B is the same, but the control servo port is different. This function requires two parameters, one is the direction
and the other is the speed. 1 or -1. The minimum speed is 0 and the maximum value is 100. Since the speed adjustment
is adjusted by PWM, it is actually equivalent to adjusting the voltage value of the motor port. The motor has a
deceleration mechanism as a load. There will be no rotation, so the speed value should not be too low.