case 05 Crazy dance
14. case 05 Crazy dance#
14.1. Our Goal#
To make the Ring:bit car to dance in free style.
14.2. Requiered Materials#
1 x Ring:bit Car
14.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.
Snap the block
set left wheel at pin P1 right wheel at pin P2to the
The port number is based on the actual servo connection port.
Snap blocks into
Set an varieble to
leftand an variable to
Generate a random number and assinment to the
Set the left wheel speed to the variable left abd the right wheel speed to the variable right.
Pause for one second.
If you don’t want to type these code by yourself, you can directly download the whole program from the link below:
The car runs at different speed.
How do you ensure the car moves at a slower speed constantly?