Welcome to Building:bit Superkit repository
1.Dance battle
Dance battle
Dance battle1. Learning Objectives2. Building Blocks3. Motor Wiring4. Code analysis5. Write and download the program6. Experimental phenomenon
1. Learning Objectives
In this course, we mainly learn how to use Python programming to make the dump truck "sing" and "dance" at the same time, that is, the motor, servo, buzzer, and RGB light work at the same time.
2. Building Blocks
For the building block steps, please refer to the installation drawings of [Assembly course]-[Skip car] in the materials or the building block installation album.
3. Motor Wiring
The motor wiring on the left side of the car is inserted into the M1 interface of the Super:bit expansion board, and the black wire is close to the battery side;
The motor wiring on the right side of the car is inserted into the M3 interface of the Super:bit expansion board, and the black wire is close to the battery side;
The building block servo wiring is inserted into the S1 interface of the Super:bit expansion board, and the orange servo wiring is inserted into the yellow pin of S1.
As shown below:

! Notes:
When taking a course related to the building block servo for the first time, we need to remove the gear on the servo and upload the program of this course to the micro:bit; then turn on the power switch of the Super:bit expansion board and wait for the building block servo to turn to the initial position; then, we can turn off the power, adjust the angle of the car loading platform to be parallel to the ground, and then install the servo gear. (If you have used the dump truck and servo-related programs before, you can skip this step)

4. Code analysis
For the program of this course, please see the Dance battle.py file.
from microbit import *import musicimport superbitimport microbitimport neopixelFirst, import the libraries needed for this lesson from microbit: the superbit library is dedicated to the superbit expansion board; the music library is used to play music; and the neopixel is used to control the RGB light.
xxxxxxxxxxdisplay.show(Image.HAPPY)np = neopixel.NeoPixel(pin12, 4)superbit.servo270(superbit.S1, 120)display.show(Image.HAPPY): Display a smiley face pattern on the microbit dot matrix;
np = neopixel.NeoPixel(pin12, 4): Initialize the RGB light. There are 4 RGB lights in total, connected to the P12 pin of the microbit motherboard (you can check the hard