

Open KidsBlock and connect the board to computer. Choose File –> Load from your computer.

Choose path D:\Code\1.Code_kidsuno and open 4.4Manual mode.sb3.

Click
to connect to port and then
.

Code Blocks
|
Blocks |
Code block |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

Build blocks:
Click
to import library DC Motor.

Initialization
Set the sensor pin to D2. Define a variable press with an initial value of 0 to monitor the state of motor.


Main Code
Loop:
When the module is touched (D2 reads 1) and press = 0, the fan rotates, and press will be reassigned to 1.
When the module is touched (D2 reads 1) and press = 1, the fan stops, and press will be reassigned to 0.




