Welcome to Tiny:bit Pro repository
3.6 Mask Testing
3.6 Mask Testing
3.6 Mask Testing1. Learning Objectives2. preparation before class3. Programming Methods4. Blocks5. Code6. Download code7. Experimental Phenomena
1. Learning Objectives
In this course, we mainly learn how to let the K210 vision module perform mask recognition. When it is recognized that no mask is worn, the buzzer will issue a warning, and the LED dot matrix of the car will display "×", When the ultrasound detects approaching, the car backs up. When it is recognized that wearing a mask, the LED dot matrix of the car will display "✔" and make a cheerful sound.
2. preparation before class
- Take out the TF card from 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.
Click Extension, copy the package URL: https://github.com/YahboomTechnology/K210-Module.git to the input field, click Confirm to add package,
Click Extension again, copy the package URL: https://github.com/YahboomTechnology/Tiny-bitLib to the input field, click Confirm to add the package.
Finally you can use the K210 Vision Module package and Tinybit's building blocks.
4. Blocks
5. Code
6. Download code
Connect the Micro:bit board to the computer via microusb cable, the computer will pop up a USB disk.
Then, select the k210_Mask_detection.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, we can see the number 6 displayed on the dot matrix of the microbit.
Wait for the screen to display the camera image, and then use the camera to capture the face.
When wearing a mask, a green box and "with mask" will be displayed, the LED dot matrix of the microbit will display "√", and the car will play cheerful music;
When not wearing a mask, the red frame and "without mask" will be displayed, the LED dot matrix of the microbit will display "×", the buzzer of the car will alarm, when the alarm is reached, the car will back up, and "--__-- will be displayed .
