Case 04: The Birds Nest
Contents
6. Case 04: The Birds Nest#
6.1. Introduction#
The human activities have changed a lot on the living environment of birds, the birds are not easy to find places to rest and food in cities, therefore, we could make a bird nest for them to live.
6.2. Function#
Control the lighting of LEDs in different colors from the tilted status of the micro:bit to remind people of protecting the nests.
6.3. Products Link#
6.4. Picture#
6.5. Hardware Connection#
Connect the green LED to P1, the yellow to P2 and the red to P9 on IoT:bit.
6.6. Software Programming#
Click “Advanced” in the MakeCode to see more choices.
For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “iot-environment-kit” in the dialogue box to download it.
Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.
6.7. Program#
Turn on the lights in accordance with the micro:bit status, if the micro:bit logo faces upwards it means the nest is in a normal status with the green led turnning on; if the yellow led lights on, it means the micro:bit is in a tilted status which means the nest is tilting to the left/right side; or the red means the nest is upside down now and it requires a re-construction.
6.8. Result#
The nest is in a normal status if the green led is turnning on; if the yellow led lights on, it means the micro:bit is in a tilted status which means the nest is tilting to the left/right side; or the red means the nest is upside down now and it requires a re-construction.