Welcome to Building:bit Superkit repository
3.8 Automatic safety door
1. Learning target
In this course, we will learn how to use Micro:bit and color recognition module to make a automatic safety door.
2. Preparation
Connect the module to Micro:bit board by expansion board, as shown below.
Note: The building block parts required for assembling the automatic door need to be purchased additionally. Link:https://category.yahboom.net/products/buildingbit-super-kit
3.Programming method
Mode 1 online programming: First, we need to connect the micro:bit to the computer by USB cable. The computer will pop up a USB flash drive and click on the URL in the USB flash drive: http://microbit.org/ to enter the programming interface. Add the Yahboom package https://github.com/YahboomTechnology/module_world_color and https://github.com/YahboomTechnology/SuperBitLibV2 to program.
Mode 2 offline programming: We need to open the offline programming software. After the installation is complete, enter the programming interface, click【New Project】, add Yahboom package: https://github.com/YahboomTechnology/module_world_color and https://github.com/YahboomTechnology/SuperBitLibV2, you can start programming.
4.Looking for blocks
The following is the location of the building blocks required for this programming.
5.Combine block
The summary program is shown below.
5. Phenomenon
After the program is downloaded successfully. The servo is initialized to 0 °. When the color sensor recognizes blue, it will open the door, and the micro bit dot matrix displays "Smiling face". The door will be closed two seconds later. If it is detected that the door is not opened in other colors, the micro bit dot matrix displays "Sleep" pattern.