Handle Game Joystick Tutorial A.Building block car 7.handle remote control Tower crane
handle remote control Tower crane
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 Tower-crane-program.hex in the Tower crane code folder to the micro:bit board of the Sniper.
2. You should download the Handle-rocker-program.hex in the bit handle code folder to the micro:bit board of the handle.
3. If you want to use the handle gravity sensing to control the Tower crane, you should download the Handle-gravity-sensing-program.hex in the bit handle code folder 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 Tower crane 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 Tower crane 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 rise, drop, left and right rotation of Tower crane.
2.Preparation before class
We needs to be ready:
Building Block Tower crane *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.
Tower crane programming:
Next, we started to write the program for the building block Tower crane. After the writing, we need to download the program to the micro:bit board of the building block Tower crane.
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 Sniper, that is Handle gravity sensing control.
Handle gravity sensing control program is shown below:
- Last Tutorial>>
- Next Tutorial>>