Yahboom Omibox Robot Kit Basic Course 3.5 Automatic lighting
1-1.The position of the Photo-resistor in the robot car
1-2. Learn how to use Photo-resistor graphically program building blocks
As shown in the figure above, we circled the red wire frame with a Photo-resistor, and we can use it by programming.
In this lesson, we will learn about the use of Photo-resistor. When the light intensity is weak (night), the lights are on; when the light intensity is strong (day), the lights are off.
3.Search for blocks
How to get threshold
1)Write the program shown below to display the value of the Photo-resistor output on the dot matrix.
2) Record the value A1 of the Photo-resistor output displayed on the dot matrix in the current environment.
3) Cover the light source sensor by your hand and record the value A2 of the Photo-resistor output displayed on the dot matrix at this time.
4）The threshold is a value in the middle of A1, A2.
After the program is uploaded, the car is powered on normally. When the light is in a dark environment, the lights are turned on. When in a hight-brightness environment, the lights will be closed.
The code of the experiment: 5.Automatic lighting.rar