Remote Control Everything!
Do you already have a micro:bit project you’d like to control from afar?
Partner up with a friend, or grab a spare micro:bit, to make a remote controlled project with 2 micro:bits. (Don’t grab a friend’s micro:bit. Be nice.)
- Enable remote-controlling for the micro:bit car from this tutorial.
- Use a spare micro:bit to make a remote control for an existing project!
- Remote control everything!
- Set your radio group in makecode. This ensures your transmitter and receiver are on the same channel.
- Think about what each button on your remote control should control.
- Radio send a different number with each button press event block by using the blocks shown.
- You can find these blocks under the Radio drawer.
- Download this to the micro:bit you’ll be using as your remote control.
- Now each of the buttons on your micro:bit remote will send a different command!
- In your micro:bit car project (or the particular project you’re trying to remote control), add the same radio group block to your On Start block.
- This ensures the project you’re trying to remote control will be listening out for the right commands!
- Remember the numbers we sent from our remote control every time we pressed a button? We’re going to use that to trigger an action.
- Find the radio received block as shown from the Radio drawer.
- Use an if-then block to check if the number you received was the number you sent when pressing button A.
- Take the code that turns your micro:bit car left, and place it within this if-then block.
- We added an led indication pointing left too, just to show what was supposed to happen.
- Turn off the left servo afterward by digitally writing the pin to 0.
- Do the same for the code that turns your micro:bit car to the right!
- Make sure you turn the right wheel off afterward.
- You can always choose to leave the wheels on without stopping after receiving each command. But you’ll be faced with a car that keeps spinning in circles.
- Download this program into your micro:bit car.
- Now that all your code is snugly tucked into your micro:bits, attach your battery packs and get going! Play around and see what other commands you can send with the A+B button, or try different kinds of inputs instead of buttons. Then remote-control
- your other micro:bit projects. World domination without leaving your seat! ヽ(´▽`)/