Welcome to Building:bit Superkit repository
1.Soldiers on duty
Soldiers on duty
Soldiers on duty1. Learning Objectives2. Building Blocks3. Motor Wiring4. Programming4.1 Add expansion package4.2 Blocks used4.3 Combining blocks5. Experimental phenomenon
1. Learning Objectives
In this course, we mainly learn how to use MakeCode graphical programming to achieve that when the micro:bit A button is pressed, the dot matrix displays the direction of the door movement (left), the buzzer beeps shortly, and the security automatic door closes; when the micro:bit B button is pressed, the dot matrix displays the direction of the door movement (right), the buzzer beeps shortly, and the security automatic door opens.
2. Building Blocks
For detailed steps of building blocks, please refer to the installation drawings of [Assembly course]-[Auto-door] in the materials or the building block installation album.
3. Motor Wiring
Insert the building block servo wiring into the Super:bit expansion board S1 interface, and the servo orange wiring into the yellow pin of S1.
As shown in the figure below:

! Notes:
When taking a course related to the building block servo for the first time, we need to remove the blue building block installed 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 security automatic door to the open state, as shown in the figure below, and then install the blue building block. (If you have used the security automatic door and servo related programs before, you can skip this step)


4. Programming
Method 1 Online programming:
First, connect micro:bit to the computer via a USB data cable. The computer will pop up a U disk. Click the URL in the U disk: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom software packagehttps://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
4.1 Add expansion package


4.2 Blocks used
The location of the blocks required for this programming is shown in the figure below.



4.3 Combining blocks
The summary program is shown in the figure below.

You can also directly open the microbit-Soldiers-on-duty.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of this project source code will be automatically opened.
5. Experimental phenomenon
After the program is downloaded successfully, the micro:bit dot matrix will display a heart. Turn on the power switch, and a heart pattern will be displayed on the micro:bit dot matrix. When the micro:bit A button is pressed, the dot matrix displays the direction of the door moving (left), the buzzer beeps briefly, and the security automatic door closes; when the micro:bit B button is pressed, the dot matrix displays the direction of the door moving (right), the buzzer beeps briefly, and the security automatic door opens.
Six patterns are written in this program, and you can modify the program to add more patterns.