Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
34
/
86
condition of “1” that we preset at beginning, so the program under the statement will be executed.
However, when it returns “0”, the program under the statement will be skipped.
STEP 3: If the button is pressed, the fan will be turned on; otherwise it stays off. The “if-else” function
under “logic” will help us make the choice depending on the status of the button.
STEP 4: By putting the function blocks mentioned above all together, we should end up with a
program with the following function: when the button is pressed, the fan is turned on, when it is
released, the fan is turned off.