Case 08: Search for Light
10. Case 08: Search for Light#
Build a Wonder Rugged Kit that can search for light.
10.3. Background Knowledge#
Click “Advanced” in the drawer of MakeCode to see more choices.
For programming the Wonder Rugged Kit, we need to add a package. Click “Extensions” at the bottom of the drawer and then search “Wukong” in the dialogue box to download it.
Note: If you get a warning indicating some packages will be removed because of incompatibility issues, you can follow the prompts or create a new project in the menu.
Wukong to choose
on start block and set the connection for servos accordingly, then initialize the LEDs.
i as the brightness level and judge the value of it. If the value of
i is below 50, the car turns left; or it moves forward.
You can also download it directly:
The car spins itself if no light being detected, or it goes straight towards the light.
If we want the farther away the car is from the light source, the faster it is; and the closer it is to the light source, the slower it is, how to programme?