Introduction to Programming

Week 1: Beating heart - Beginner

FundamentalBefore you start doing the classwork

Click on this link

Click on Get Started

Click on I'm Student

Select Sign in with Google

You will have your account display here (this is my account that is why it shows my name).

Select your account and enter your username and password for your Google accounts.

What is it?

Make your micro:bit's heart beat using loops to create an animation.

ExtraVideo explaining the task

ReminderOpen the Microbit editor

You will need to visit this website to the work: Microbit Makecode

Once you are there, click on New Project.

You have done this already many times !!

MethodHow it works

  • The program shows a beating heart using two built-in pictures, a large and 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.

  • After showing each image, the program pauses for half a second (500 milliseconds) before showing the next image.

  • The animation is kept going forever using an infinite loop: it repeats the sequence of showing these two images and pausing until you unplug the micro:bit.

  • Using loops to keep things happening is an important idea in computer programming: we have created an animation that will keep running for as long as the micro:bit has power using only a small amount of code. This is also called iteration.

ExampleCode

This is the code you will need.

WarningTask 1. Improve it

  1. Make the heart beat faster or slower by changing the delay time.

  2. Try animating other built-in images like the small and large diamond or square.

  3. Create your own animations using your own designs.

ReminderUpload your work on your google classroom

Watch these two videos to remind you on how to do this.

PreviousPreviousNextNext
HomepageHomepagePrintPrintCreated with Scenari (new window)