Handle Game Joystick Tutorial A.Building block car 2.handle remote control Tank car
The above three programs, which we have provided. They are in the course directory.
If you want to use the program we provide directly, Please read the following carefully:
1. You should download the Tank-program.hex to the micro:bit board of the Tank.
2. You should download the Handle-rocker-program.hex to the micro:bit board of the handle.
3. If you want to use the handle gravity sensing to control the Tank, you should download the Handle-gravity-sensing-program.hex to the micro:bit board of the handle.
After the program is downloaded, the handle and the car are powered up normally, they will be automatically paired, the two micro:bit board LED dots will show a heart on it, you can start to control.
After downloading the program, open the power switch of the Tank and the power switch of the micro:bit handle, they will be automatically paired. When you press the micro:bit handle remote control button, the Tank will have the corresponding action. The button on the right side of the remote control is used to control the color of the lights, and pressing the joystick down to turn off the light. Pushing the rocker forward, backward, left ,right is to control the advance, back, turn left and turn right of the Tank.
2.Preparation before class
We needs to be ready:
Building Block Tank*1
USB data cable*1
2-1.Two programming methods:
First, we need to connect the micro:bit to the computer by USB data cable, the computer will pop up a USB flash drive.Then, click on the URL in the USB flash drive: http://microbit.org/ to enter the edit process interface, click to 【Extensions】, and copy the package URL: https://github.com/lzty634158/yahboom_mbit_en to the input field, and you can use the building blocks of the Yahboom software package.
Open the offline programming software, click to 【Extension】 and copy the package URL: https://github.com/lzty634158/yahboom_mbit_en to the input field, and you can use the building blocks of the Yahboom software package.
For detailed programming, please read the documentation before class 【1. Preparation before class】----【Introduction of programming method】. We use micro:bit official website for online programming in here.
Tank car program:
Next, we started to write the program for the building block Tank. After the writing, we need to download the program to the micro:bit board of the building block Tank.
The program is shown below:
Handle joystick control program:
After adding the https://github.com/lzty634158/GHBit package, we can see the Yahboom handle blocks in the left side of the building block, as shown below:
Next, we started to write the joystick control program. After writing, we need to download the program to the micro:bit board of the handle.
The program is shown below:
We also offer another way to control the Tank Car, that is Handle gravity sensing control.
Handle gravity sensing control program is shown below:
- Last Tutorial>>
- Next Tutorial>>