micro:bit Programming - Use buttons to control your micro:bit robot
July 03, 2018
In this tutorial, we'll walk you through how to use Button A and Button B on your micro:bit. We will use the GiggleBot robot for the micro:bit to show how you can use Buttons to give commands.
Finding The Buttons
You can find the buttons in MakeCode under "Input" on the programming palette.
The input button is the first block at the top!
Programming the Buttons to Control a Robot
Drag the block onto the programming canvas.
Now, we can place any command under the "on button A pressed" and that command will be executed!
Now, when we press button A, the GiggleBot will drive forward.
Put It All Together
Let's write a quick program to expand on the button press. When we press button A, the GiggleBot robot will drive forward. When we press button B on the micro:bit, the robot will stop.
If you're interested in getting started with robots and the micro:bit, check out the GiggleBot micro:bit robot here! You can see more programming examples for the micro:bit robot here.