This Microsoft MakeCode package is used as an Grove Zero - BitKit extension for micro:bit.
Simply add the 'Grove Zero' package in the MakeCode for microbit, then program your micro:bit with the drag and drop blocks as usual.
Use this block to move your chassis forward/backward/left/right/clockwise/counter-clockwise with different speed slow/medium/fast.
Use this block to stop the chassis.
Use this block to set the speed of the two motors on the chassis. A speed of "255" for both motors makes the chassis move forward at full speed, and a speed of "-255" for both motors make the chassis move backward at full speed.
Line Detections
Use this block to detect the line position and make your micro:car do something.
You can also put this boolean block in a 'if' block for detecting line.
About the line position
Provided that the line width is about 5mm (if you use the marker included in the Bit Kit), the following image illustrates how the Color Line Follower see the line position when the car moves.
In some cases, users may draw a line wider than 5mm (which most people do that). As a result, when the sensor sees a line at 'middle', it could be a thin 5mm line detected by the middle optical sensor, or a wide 10mm line detected by the 3 middle optical sensors simutaneously. To the cover as many situations as possible and chieve a smooth line following the Color Line Follower works in a way as illustrated below:
Color Detections
Use this block to detect the color and make your micro:car do something.
You can also put this boolean block in a 'if' block for detecting color.
The Color Line Follower is specially calibrated for detecting the color of the marker pens included in the Bit Kit. But please be noted that, in general, the color detection can be influenced by the ambient light, the surface of the object or the gray scale of the color. So in most of time, the color sensor may not work as you expected if you are detecting something else.
The following block returns the color in r,g,b.
MIT
- for PXT/microbit