Case 60: Raising the National Flag
64. Case 60: Raising the National Flag#
We deeply love our country, and the symbols that best represent our country are the national flag that we often see and the national anthem that we often hear, in this lesson we will do the case of raising the national flag to express our love for our country, let’s start.
Nezha expansion board × 1
micro:bit V2 × 1
RJ11 cable × 1
Bricks × n
Note: If you want all of the above components, you may purchase the Nezha 48 IN 1 Inventor’s Kit.
Build it as the assembly steps suggest:
64.2. Connection Diagram#
Connect the four motors to the M1.
64.3. MakeCode Programming#
Click “Advanced” in the MakeCode drawer to see more choices.
For programming the servo, we need to add a package. Click “Extensions” at the bottom of the drawer and search with “nezha” to download it.
For programming the PIR sensor, we need to add a package. Search with “PlanetX” in the dialogue box and click to download it.
Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.
The program is shown below:
You may also download it directly:
We can see that when the A button is pressed, the music is played as the flag rises, and when the B button is pressed, the flag falls.