#FutureSTEMLeaders - Wiingy's \$2400 scholarship for School and College Students

Apply Now

Tutoring

Learn

Resources

# How Do You Make a Beating Heart Game on a micro:bit?

Updated By

Reviewed By

The MakeCode micro:bit beating heart game is one of the fundamental games taught to children in micro:bit to lay a solid foundation in coding concepts. In the beating heart micro:bit project, we will be using forever show and pause blocks. Using these three blocks, we will create two hearts, where one heart is small and the other heart is big.

To create the effect of a beating heart on micro:bit, we will show the small heart first, pause the LEDs, and then display the big hearts on the LED. This article describes in detail how to create a beating heart game on the micro:bit. Scroll down to find out more.

## Working of micro:bit Beating Heart Game

From the below figure, you can see the beating heart LEDs.

The above GIF shows a beating heart using two built-in pictures, a large and a small heart, on the micro:bit’s LED display. Different images shown in a sequence create the illusion of movement: a heart getting larger and smaller.

## Things Required to Program a Heart That Beats on micro:bit

The list of things required to code a beating heart game in micro:bit are as follows:

• micro:bit or MakeCode micro:bit Simulator
• Python or MakeCode Editor

## How To Create Beating Heart Game on micro:bit?

The detailed step-by-step procedure on how to create a beating heart game on micro:bit are explained below:

• Step 1: Visit the official website of MakeCode micro:bit.
• Step 2: Click on the “New project” button.
• Step 3: Name your project “Beating the Heart Game.”
• Step 4: Now click on “Basic” and place the “show icons” block in the “forever” block.
• Step 5: The heart image appears in the simulator. Now the next step is to pause the program for 200 milliseconds. Hence, make changes in the milliseconds section to 200 and place it under the show icons block.
• Step 6: Click on the “Basic” block and place the “Show icon” block under the “Pause block.”
• Step 7: Now select the “small heart” icon from the drop-down menu.
• Step 8: After showing each image, the program should pause for 200 milliseconds before showing the next image. Hence, add a “pause block” again under the “show block” and enter 200 milliseconds.
• Step 9: Click on “restart the simulator” and you will see the beating heart on the micro:bit simulator as shown in the image below.

If you have a micro:bit connected, click “Download” to transfer your code and watch the Heart beating!

## Beating Heart Code Micro Bit

The detailed code used to create a beating heart project on micro:bit is given below:

We hope this article on how to create micro:bit beating heart game is helpful to you. If you have any questions related to this post, ping us through the comment section below and we will get back to you as soon as possible.

## FAQs

How to make a beating heart project on micro:bit?
The steps involved in making a beating heart project in micro:bit is given below:

1. Click on “Basic” and place the “show icons” block in the “forever” block.
2. Now the next step is to pause the program for 200 milliseconds. Hence, make changes in the milliseconds section to 200 and place it under the show icons block.
3. Now select the “small heart” icon from the drop-down menu.
4. After showing each image, the program should pause for 200 milliseconds before showing the next image.
5. Click on the “restart” of the simulator and you will see the beating heart on the micro:bit simulator