Welcome to micro:bit camera platform repository
micro:bit camera platform
In this lesson, we mainly study how uses the serial port of micro:bit to receive the information transmitted by the wifi camera, and analyzes the commands received by the serial port.
Then, micro:bit drives the corresponding motor and servo, that is, control the rotation of micro:bit camera platform.
Mode 1 online programming: First, we need to connect the micro:bit to the computer by USB cable. The computer will pop up a USB flash drive and click on the URL in the USB flash drive: http://microbit.org/ to enter the programming interface. Add the Yahboom package https://github.com/lzty634158/SuperBit to program.
Mode 2 offline programming: We need to open the offline programming software. After the installation is complete, enter the programming interface, click【New Project】, add Yahboom package:
https://github.com/lzty634158/SuperBit, you can program.
3.Looking for blocks
The following is the location of the building blocks required for this programming.
4.Combine building block
The summary program is shown below:
1. Serial port initialization definition at boot time, set TX to P12, RX to P13, baud rate is 9600; set initial serial port receive data to "0"; set two servos initial angle to 90°; set micro: bit dot matrix display Smiley face.
The serial port information is obtained cyclically, and the information before the "#" is saved in data.
2.Create the SerialReceive2 function, compare the data with the manipulation command, if it meets a certain control command, the drive motor servo, otherwise it will not execute.Make the left and right rotation of the servo every time the rotation is 5 °.
3. Create a LimitValue function to limit the values of servoleft and servooes from 10 to 170.
4.The SerialReceive2 and LimitValue functions are called cyclically, and control the servo to rotate to the specified degree.
We need to connect the Wifi camera interface to the serial port of the mbit expansion board:
The servo camera that controls the up and down rotation in the wifi camera is inserted into the S1 interface of the expansion board.
The servo camera that controls the up and down rotation in the wifi camera is inserted into the S2 interface of the expansion board.
The orange interface of the servo is connected to the yellow pin, the red interface is connected to the red pin, and the brown interface is connected to the black pin.
7.Building block assembly steps
Please refer to micro:bit_camera_platform_assembly instructions file.
8. Experimental phenomena
After the program is successfully downloaded, the micro:bit dot matrix will display a smile; the wifi camera's indicator light will illuminate.
We need to use the Android mobile phone to search for wifi signal(Yahboom_WIFI, no need password) and connect to it.
After the wifi connection is successful, open the APP and enter the control interface.
Press the up, down, left and right buttons to control control the rotation of micro:bit camera platform.
Download code: microbit-microbit_camera_platform.rar