Auto Windows
Introduction
In this project, we will learn how to make an intelligent noise - controlling door and window.
Note: This case cannot use the set of structural parts to simulate the application scenario, but can realize the basic case production.
Teaching Objectives
Review the functions of micro:bit
Understand the hazards of noise
Teaching Preparation
Before starting the teaching, please make sure you have prepared the following necessary materials:
| Picture | Name | Quantity | Remarks |
|---|---|---|---|
| Smart Home Explorer Kit | 1 | ||
![]() | micro:bit | 1 | Prepare by yourself |
![]() | PC | 1 | Prepare by yourself |
These materials will provide you with a complete experience and ensure that you can proceed smoothly with the subsequent operations and learning. If you have prepared the above contents, we can move on to the next step.
Course Introduction
In this class, we will make an intelligent noise - controlling door and window. When the micro:bit detects that the noise exceeds the threshold, it will automatically rotate the servo to close the door and window.
Project Production
Hardware Connection
Connect the Adapter to the J1 interface of the Petal Basic Expansion Board.
Connect the 180° servo to the S1 interface of the Adapter.

Programming Platform
We usually use the graphical programming platform makecode to program the micro:bit.
Programming platform entrance: https://makecode.microbit.org/
Create a New Project
Open https://makecode.microbit.org/https://makecode.microbit.org/)

Create a new project

Enter the project name and click Create.

Add Software Library
Click Extensions in the Toolbox of the makecode programming interface.

Search for petal on the pop - up page and click to select the petal software library.

Write the Program
Sample program: https://makecode.microbit.org/_0WVYbw4gVdwRhttps://makecode.microbit.org/_0WVYbw4gVdwR)

You can also download the program directly through the following web page.
How to Download the Program to micro:bit?
Use a USB cable to connect the PC and micro:bit V2.

After successful connection, a drive named MICROBIT will be recognized on the computer.

Click
in the lower left corner and select Connect Device.

Click
。

Click
。

In the pop - up window, select BBC micro:bit CMSIS - DAP, then select Connect. So far, our micro:bit has been connected successfully.

Click to download the program.

Result
When the water level sensor detects water accumulation, it will automatically turn on the red light for prompt.


