Without light, there would be no sight. We are able to see because light from an object can move through space and reach our eyes. But human eyes are very sensitive to light, both too strong and weak lights are harmful to our eyes. How do we know the changes in light brightness? Maqueen Plus V2 can help us achieve that.
1. Learn the light sensor
2. Learn how to use the“show number”block
STEP 1 Create a new project
1. Input https://makecode.microbit.org/ into your browser to enter the MakeCode editor.
2. Click “new project”to enter the MakeCode programming interface.
3. Add the Maqueen Plus V2 library: https://github.com/DFRobot/pxt-DFRobot_MaqueenPlus_v20
STEP 2 Programming
1. Put the “show number”block into the “forever”block, then the robot eyes will read the light level constantly.
2. To display the ambient light level on the micro:bit LED screen in real-time, we have to put the “light level”block into the“show number”block.
3. The complete program is shown below.
4. Name your project as“Light sensing robot”and save it.
STEP 3 Download Program
1. Connect to PC: connect the micro:bit to your computer with a USB cable before downloading. There will be a hard disk named micro:bit appearing in the computer when the connection is successful.
2. Download the program: download your project into the micro:bit hard disk.
3. Plug in the micro:bit board: after downloading the program, plug the micro:bit board into Maqueen Plus V2.
STEP 4 Effect Display
Turn on the power switch of Maqueen Plus V2, the LED screen will constantly display the current light level! The following are the light levels measured at the office and photo studio.
Think & Explore
Light level varies from places, let our Maqueen Plus explore! After that, please think if the light level of each place is reasonably designed.
Engage in learning the next Robot project：Moth Robot
Engage in learning the previous Robot project : City Defender - A Police Car