micro:bit Programming - Use buttons to control your micro:bit robot

button gigglebot button programming

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.  

robot input button for make:code

The input button is the first block at the top!

Programming the Buttons to Control a Robot

 Drag the block onto the programming canvas.

robot press button a for make:code and GiggleBot

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.

GiggleBot programming the micro:bit using the button A and button B on the micro:bit


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.

Older Post Newer Post