Yahboom Omibox Robot Kit arduino IDE course 5.15 Tracking
1-1. The position of the Tracking sensor on the robot car
1-2. Learn about the Arduino Uno pins connected to the Tracking sensor of Omibox programmable robot
1-3. Learn to understand the principle of Tracking
The basic principle of the tracking sensor is to use the reflective nature of the object. Our experiment is to tracking the black line. When the infrared light is emitted to the black line, it will be absorbed by the black line. When the infrared light is emitted to the other color line, it will reflected to the infrared receiver tube.
When the tracking module of the robot car detects a black line, the indicator light is off, and the indicator light is on when a white (no black) object is detected. We write the corresponding code to complete the tracking function according to this point.
According to the hardware manual, we can know that
Controlling the left motor forward is the Pin1 of the PCA9685.
Controlling the left motor back is the Pin2 of the PCA9685.
Controlling the right motor forward is the Pin15 of the PCA9685.
Controlling the right motor back is the Pin14 of the PCA9685.
The left tracking sensor is connected the pin7 of the Arduino Uno.
The right tracking sensor is connected the pin8 of the Arduino Uno.
The main program of this experiment is as follows:
1.We need to open the code of this experiment: Tracking.ino, click“√” under the menu bar to compile the code, and wait for the word "Done compiling " in the lower right corner, as shown in the figure below.
2. Click 【Tools】 --- 【Board】 -- we need to choose Arduino Uno. As shown in the figure below.
3.In the menu bar of Arduino IDE, we need to select 【Tools】---【Port】--- selecting the port that the serial number displayed by the device manager, as shown in the figure below.
4. After the selection is completed, you need to click “ → ”under the menu bar to upload the code to the Arduino UNO board. When the word “Done uploading” appears in the lower left corner, the code has been successfully uploaded to the Arduino UNO board, as shown in the figure below.
After the program is uploaded, make the Omibox on the black track on the white background, or use our color track directly and open the power of the Omibox. We can see that the car will advance along the black track.
For the tracking sensor, except for black, other colors of the material cannot absorb the infrared light emitted by the infrared emission tube, so when the tracking probe detects the color track, it is equivalent to recognizing the white color. Tracking experiments can be completed.
Note:In order to avoid the interference of sunlight on the infrared light, the experiment must be carried out indoors！
The code of the experiment: 15.Tracking.rar