Yahboom Omibox Robot Kit Expand Course Expand course13-Music track
1-1.The position of the buzzer, Infrared sensor and color recognition sensor in the robot car
1-2.Learn to understand the principle of tracking
1-3.Learn how to combine buzzer, color recognition with infrared tracking graphical programming blocks
As shown in the above picture, we circled the Infrared avoid sensor with two red wire frame, we circled the tracking sensor with two violet wire frame, we circled the buzzer with a orange wire frame, we circled the color recognition sensor with a green wire frame. We can control them by programming.
In this lesson we learn how to make Omibox tracking, while the color recognition sensor detects the color of the track and displays it through the colorful lights. The buzzer will emit different tones when different colors are detected.
3. Search for blocks
The following is the location of the building blocks required for this programming.
The summary program is shown below:
After the program is uploaded, turn on the power of the robot. We can see that the Omibox robot will advance along the track. The lights will show different colors according to the color of the track, and the buzzer will play different tones.
Note: In order to avoid the interference of sunlight on the infrared light, the experiment must be carried out indoors.
How to take the threshold
Because the light intensity of the environment in which everyone is located is different, it will affect the data acquired by the color sensor. If the buzzer plays music, the experimental effect is not well. You can get the value of the color sensor and modify the parameter range in the program by following the steps shown below.
1.Write the program shown on the right and download it to the Omibox programmable robot.
2. Place the Omibox programmable robot on the different color areas of the color track, then observe and record the values of R, G, and B displayed on the LED matrix.
! ! ! Note:
First, the matrix will display R, after waiting for 1 second, the displayed data is the red value Value_R returned by the color sensor.
After waiting for 3 seconds, the matrix will display G, after waiting for 1 second, the displayed data is the red value Value_G returned by the color sensor.
After waiting for 3 seconds, the matrix will display B, after waiting for 1 second, the displayed data is the blue value Value_B returned by the color sensor,
Waiting for 3 seconds, and keep the loop in such a state.
Then, we can get R>Value_R-20 and Value_R+20<R, G>Value_G-20 and Value_G+20<G, B>Value_B-20 and Value_B+20<B
3. Observe the value recorded by yourself, and then take different intervals according to the above method to modify the parameter range in the program.
The code of the experiment: 13.Music track.rar