Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
46
/
86
Goal: we will replace the button with a motion sensor to control the servo. When someone
approaches, the door opens. Otherwise it stays closed.
STEP 1: Replace the button module with the motion sensor.
STEP 2: The motion sensor is connected to P1. Thus, we can read the value of the motion sensor.
Function used in this part is: “Pins”=>”digital read”. Remember to replace the default P0 by P1.
STEP 3
:
When someone is detected by the motion sensor, the servo rotates to 100
°
, the micro: bit
shows "O"; otherwise the servo rotates to 0
°
and the micro: bit shows "X". The function block used in
this step is “if else”.