A First Micro:bit Project With Two Buttons

A First Micro:bit Project With Two Buttons

A Micro:bit project can begin with a simple question: what should happen when I press a button? I like starting with one visible response, because it makes the connection between an action and the board’s display easy to understand. Here, button A shows a heart and button B clears the screen.

Set Up The First Response

Open MakeCode and create a new Micro:bit project. Add an “on button A pressed” event, then place a “show icon” block inside it and choose the heart. Download the program to the board or use the simulator to check that pressing A produces the display.

Give Button B A Job

Add a second button event for button B and place a “clear screen” block inside it. Now the two inputs have distinct outcomes: one draws an icon, while the other turns the display off. Keeping each action in its own event also makes the logic easier to inspect when something doesn’t behave as expected.

Make The Small Project Yours

Once both buttons work, swap the heart for another built-in icon or draw a small pattern with the LED grid. Change one thing at a time, then run the program again so you can tell what each edit changed. This modest project introduces a useful habit: make a clear prediction before changing the code.