

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

Choose D:\Code\2.Code_kidsIOT to open 4.1Manual_lighting.sb3

Click
to connect to port and then
.

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

Conceive:
Initialization
Set the pins of white LED module and button module, initialize the serial monitor.


Main Code
Loop: Determine whether the button is pressed. If it is, the button outputs 0. If not, the button outputs 1.
Press the button (pin IO26 reads value 0), and LED will light up (pin IO23 outputs 1 to LED module).
Release the button (pin IO26 reads value 1), and LED will go off (pin IO23 outputs 0 to LED module).




