4. Ring:bit Introduction of E-blocks¶
4.1. Add New Extensions¶
We’ll need to add a package of code to be able to use our ring:bit car.
Add new package by following below steps.
Step 1¶
Click on “Advanced” in the Code Drawer to see more code sections and look at the bottom of the Code Drawer for “ Extensions”.
Step 2¶
Search for “ringbitcar” and click on the ring:bit car package to add it to your project. (As below picture)
4.2. Introduction¶
Pre-coding, we need to use the block to name the left wheel and the right wheel.
Above block is for the car goes straight at full speed.
Above block is for the car reverses at full speed.
Above block is for the car turns left at full speed.
Above block is for the car turns right at full speed.
Above block is for the car brakes.
Above block is for setting the rotate speed for the left wheel and the right wheel of the car.
This block can be used to judge the line follow status after you expands the line follow module.
This block can be used to receive the ultrasonic’s distance after you expands the ultrasonic distance module.
—``
Program¶
Program Link:https://makecode.microbit.org/_MitdxCVTbJfz
If you don’t want to type these code by yourself, you can directly download the whole program from the link below: