- Button X1
- 180° servo X1
- Multiple Sensors for smart house X1
- Multiple Actuators for smart house X1
- Connecting Wire X1
- micro:bit X1
- USB Cable X1
- Lolly Sticks X2
In project 4, you can learn how to use the button to open the door.
- Basic (Add block on start) > House (Add block Initialize Smarthon multiple-sensor)
- Basic (Add block forever) > Logic (Add block if…then…else) > For if : Logic (Add block 0 = 0, change “0” to House “Get button pressed”; “=” to “<”; “0” to “500”)
- For then: House (Add block Set 180 Servo to degree 0, change “0” to “90”)
- For else: House (Add block Set 180 Servo to degree 0)
- Basic (Add block pause (ms) 100)
*degrees of the servo have to be adjusted under the different condition
- Download the code and transfer to micro:bit
- Plug the micro:bit into Multiple Sensors
- Connect Multiple Sensors and Multiple Actuators by connecting wire
- Put the horn into 180° servo
- Stick “+” with the lolly sticks and stick it up on the horn
- Connect the module to 180° servo port of the Multiple Actuators and install it to the door
- Pressed the button to open the door * Try to use the other sensors, such as motion sensor to control the door.