Handle Game Joystick Tutorial A.Building block car 6.handle remote control Sniper
handle remote control Sniper
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 Sniper-program.hex in the Sniper 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 Sniper, 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 Sniper 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 Sniper 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 is to control the direction of the motor rotation to eject rubber band.
2.Preparation before class
We needs to be ready:
Building Block Sniper *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.
Next, we started to write the program for the building block Sniper. After the writing, we need to download the program to the micro:bit board of the building block Sniper.
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>>