Welcome to Tiny:bit Pro repository
2.1 Color recognition
2.1 Color recognition
2.1 Color recognition1. Learning objectives2. Preparation for class3. Programming Methods4. Blocks5. Code6. Download code7. Experimental phenomena
1. Learning objectives
In this course, we can realize K210 vision module performs color recognition.
When any one of the color, such as red, yellow, blue and green is recognized, the Micro:bit displays the initial capital letter of the English word in the corresponding color.
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 U disk. You will see following content.
- Go to the k210 folder, find the 3.1_color_rgb file from the folder and copy it to the root directory.
Delete the original main.py file.
Then, re-name the 3.1_color_rgb file as the main 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:bit USB cable, the computer will pop up a USB disk.
Then, select the microbit-color_reg.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 camera screen appears, point the camera at the color that needs to be recognized. When the color is recognized, the Micro:bit board will display the uppercase initials of the English word of the corresponding color.
As shown below.
