Welcome to Tiny:bit Pro repository
2.7 Mask warning
2.7 Mask warning
2.7 Mask warning1. Learning Objective2. Preparation for class3. Programming Methods4. Blocks5. Code6. Download code7. Experimental phenomena
1. Learning Objective
In this course. We will realize that K210 vision module performs mask recognition, and when no mask is recognized, a buzzer sounds a warning. When the mask is recognized as being worn, a cheerful sound is emitted.
2. Preparation for class
- Remove the TF card from the k210 vision module and insert it into the card reader.
- Plug the card reader into the computer, and wait for the computer to recognize the USB disk.
- Then, enter the TF card. You will see following content.
- Go to the k210 folder, find the 2.7_3.6_face_mask_detect.py file from the folder and copy it to the root directory.
Delete the original main.py file.
Then, re-name the 2.7_3.6_face_mask_detect.py file as the main.py file.
- After re-name, pull out the card reader, remove the TF card and insert it back into the k210 vision module.
3. Programming Methods
Online programming: first copy this URL https://makecode.microbit. and enter the online programming interface.
Copy the package URL: https://github.com/YahboomTechnology/K210-Module.git to the input field, click confirm to add the package, after that you can use the blocks of K210 vision module package.
4. Blocks
5. Code
6. Download code
Connect the Micro:bit board to the computer via Micro USB cable, the computer will pop up a USB stick.
Then, select the microbit-mask.hex file and right click to send it to the Micro:bit U disk.
Wait until sending is complete and unplug the Micro:bit USB cable. Plug the Micro:bit board into the car.
7. Experimental phenomena
After starting the car, wait for the screen to display the camera image.
After the screen displays the picture, take a picture of the face with the camera, when there is wearing a mask, it displays a green frame and "with mask", the Micro:bit led array shows a smiling face and the trolley emits cheerful music; when there is no mask, it displays a red frame and "without mask", the Micro:bit led array shows a crying face and the trolley alarms with a buzzer.
