Introduction
Control your Tank using Bluetooth from a phone or tablet.
Using a GamePad (or "DPAD") controller you can make the Tank forward & backward, and spin in either direction. You can also open and close the Gripper and adjust the speed of the Tank.
Tools
Video Overview
-
-
You can control your Tank using Bluetooth from a phone or tablet along with an app that supports the micro:bit's Bluetooth Messaging Event System.
-
If you are using an iPhone or iPad you can use the GamePad (or "DPAD") controller found in the “Monitor & Control” section of the micro:bit iOS app.
-
Find the iOS app here: https://apps.apple.com/gb/app/micro-bit/...
-
If you are using an Android phone or tablet you can use “Bitty Controller” which has its own “DPAD" controller option.
-
Find Bitty Controller in the Google Play store here: https://play.google.com/store/apps/detai...
-
Find more information about Bitty Controller here: https://bittysoftware.blogspot.com/p/app...
-
-
-
The GamePad may look familiar if you've ever used a video game controller.
-
The GamePad will control the Rover in the following manner:
-
1 will move forward, 2 will move backwards.
-
3 will spin to the left, 4 will spin to the right.
-
C will open the gripper, D will close the gripper.
-
A will increase speed, B will decrease speed.
-
Keep in mind you can change what any of these controls do by editing the code.
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our Tank Bluetooth program: https://makecode.microbit.org/_L9TVkqXcx...
-
Note: This code will work with either of the apps mentioned in Step 1.
-
-
-
You'll need to pair the phone or tablet with the micro:bit in your Tank.
-
Please see the extensive guide to pairing provided on the makecode.microbit.org web site: https://makecode.microbit.org/v0/referen...
-
Once you pair your device with the micro:bit on the Tank you can use the GamePad to control it!
-
-
-
The on start block has two commands to enable the Bluetooth services we need.
-
The rest of the code in the on start block is just like other Tank code.
-
The other blocks are all on event blocks, which are looking for data from the MES_DPAD_CONTROLLER_ID with a specific value.
-
Besides the on start block, each dark gray block looks for a button to be down or up, and reacts appropriately.
-
While these Control blocks look a bit more complex than other blocks, they are pretty easy to explore and use in your code.
-