Welcome to Building:bit Superkit repository
3.Micro:bit handle control
Microbit handle control
Microbit handle control1. Learning objectives2. Building blocks3. Motor wiring4. Programming4.1 Add expansion package4.2 Blocks used4.3 Add new variables4.4 Assemble building blocks5. Experimental phenomenon
1. Learning objectives
In this course, we mainly learn how to use MakeCode graphical programming to realize microbit handle control of Pretty car.
2. Building blocks
For the building block construction steps, please refer to the installation drawings of [Assembly Course]-[Pretty car] in the materials or the building block installation album.
3. Motor wiring
The motor wiring on the left side of the car is inserted into the M1 interface of the Super:bit expansion board, and the black line is close to the battery side;
The motor wiring on the right side of the car is inserted into the M3 interface of the Super:bit expansion board, and the black line is close to the battery side;
As shown below:
4. Programming
Method 1 Online programming:
First, connect micro:bit to the computer via a USB data cable. The computer will pop up a U disk. Click the URL in the U disk: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yabo smart software package to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and then add the Yabo smart software package to start programming.
superbit kit expansion package: https://github.com/YahboomTechnology/SuperBitLibV2 handle expansion package: https://github.com/YahboomTechnology/GHBitLib
4.1 Add expansion package
4.2 Blocks used
The location of the blocks required for this programming is shown in the figure below.
4.3 Add new variables
① Find the [Variable] option in the building block bar ---- [Set variable]
② Enter the variable name to complete the new variable.
4.4 Assemble building blocks
The summary program of microbit on Pretty car is shown in the figure below
Handle rocker control program is as follows
Handle gravity control program is as follows
You can also directly open the microbit-Handle-control-pretty-car.hex、microbit-Handle-rocker-control.hex、microbit-Handle-gravity-control.hex files provided in this experiment and drag them into the browser that opens the URL, and the program diagram of this project source code will be automatically opened
5. Experimental phenomenon
We need to download the Pretty car program to the micro:bit motherboard of Pretty car, open Pretty car's power switch, we can see a smiley face pattern on the micro:bit dot matrix;
Download the controller remote control program to the micro:bit mainboard of the controller, turn on the power switch of the controller, we can see that the micro:bit dot matrix will initialize to display a heart pattern, and then display an "X" pattern, indicating that the controller is in the default state and no data is sent.
The two will automatically complete the pairing, and then we can start remote control of Pretty car.
The controller functions are as follows.
!Note: In the case of joystick control of the controller, press the joystick to control the RGB light to go out. This function does not exist in the case of gravity control of the controller.