14. Case 10: Car Following with A Fixed Distance¶
14.4. Programming¶
Step 1¶
- Click the “Advanced” to see more choices in the MakeCode drawer.

- A codebase is required for Cutebot programming, click “Add Package” at the bottom of the drawer, search
Cutebotin the dialogue box and download it.

Note: If you met a tip indicating incompatibility of the codebase, you can continue with the tips or build a new project there.
Step 3¶
- Set a
Sonarvariable to save the detectedCmvalue in theForeverbrick. - If the detected value is between
5and10, the car stops moving. - If the detected value is below
5, the car reverses because of the short distance with the hands. - If not any, the car moves forward to catch up with the hands because of the far distance with the hands and then stay still .

Programming¶
Links: https://makecode.microbit.org/_YxxfyPVsmHjg
You can also download it directly below:
