13. case 04 Here comes the police
13.1. Our Goal
To change the Ring:bit car to a police car.
13.2. Requiered Materials
1 x Ring:bit Car
13.3. Hardware Connect
Connect the left wheel servo to P1 of the Ring:bit expansion board and the right wheel servo to P2.
Connect the ring:bit car special expansion board to the P0.
Slide the clip switch of the special expansion board to the Rainbow LED.
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.
Snap the block
set left wheel at pin P1 right wheel at pin P2to the
On startblock. The port number is based on the actual servo connection port.
Go straight at full speed.
2Rainbow LED of the
foreverblock, snap below blocks in line:
show color redblock.
show color blueblock.
If you don’t want to type these code by yourself, you can directly download the whole program from the link below:
The car goes straigt at full speed at red and blue flash.
How can you make youe car at yellow and white flash?