16. case 08 Light Follow¶
16.1. Our Goal¶
Make the ring:bit car to light follow.
16.2. Requiered Materials¶
1 x Ring:bit Car
16.3. Hardware Connect¶
Connect the left wheel servo to P1 of the Ring:bit expansion board and the right wheel servo to P2.
Click on “Advanced” in the MakeCode Drawer to see more code sections.
Search for “ringbitcar” and click on the ring:bit car package to add it to your project. (As below picture)
Note：If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Project file menu.
on startblock from the Basic and initialize the P1 port to left wheel and the P2 port to right wheel.
light levelfrom the Input. The car will move to the light source when the light level is greater than the defined value.
The car will spin around to find the light source when the light level is less than the defined value.
The car spins around and will move to the light source when it is detecting the light.
How can you make a smart car to detect the fire?