Welcome to Tiny:bit Pro repository
3.8 Handwritten digital control
3.8 Handwritten digital control
3.8 Handwritten digital control1. Learning objectives2. Preparation for class3. Programming Methods4. Blocks5. Code6. Download code7. Experimental Phenomena
1. Learning objectives
In this course, we will learn that how to make k210 vision module performs handwritten number recognition, which can recognise the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
For this experiment, we only edit the actions for 1, 2, 4, and 7, and when these numbers are recognized, the car performs different actions.
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.9_3.8_mnist.py file from the folder and copy it to the root directory.
Delete the original main.py file.
Then, re-name the 2.9_3.8_mnist.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 stick.
Then, select the k210_Handwritten_digital_control.hex code 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, the dot matrix of the microbit scrolls to display the number 8.
Wait for the screen to display the camera image, then point the camera at the handwritten number.
In this experiment, we performed different actions when we recognized the numbers 1, 2, 4, and 7.
When num:1 appears in the upper left corner of the display, wait for about 2 seconds, the LED dot matrix of the microbit will display the number 1, and the car will light up the breathing light;
When num:2 appears in the upper left corner of the display, wait for about 2 seconds, the LED dot matrix of the microbit will display the number 2, the car will rotate left on the spot, and the LED dot matrix of the microbit will display the dynamic rotating pattern;
When num:4 appears in the upper left corner of the display, wait for about 2 seconds, the LED dot matrix of the microbit will display the number 4, and the dot matrix of the microbit will display the dynamic heartbeat;
When num:7 appears in the upper left corner of the display, wait for about 2 seconds, the LED dot matrix of the microbit will display the number 7, the car will display the music pattern, and start playing music.
As shown below.