micro:bit Beginner – How to Program a Blinking Icon

Blinking Light on micro:bit

 

Description

This micro:bit beginner project is for people getting started with the micro:bit and with writing computer code. It requires no previous coding experience and no knowledge of the micro:bit. In fact, you don’t even really need a micro:bit because you can use the simulator available in MakeCode. If you are using an actual micro:bit, you will need to know how to plug it into your computer.

Video

Programming Language

MakeCode Blocks

Difficulty Level

Easy beginner

Programming Concepts Covered

  • Loops and Infinite Loops

Materials

No materials are required, but if you are planning to use a micro:bit, you will need a microUSB cord to plug it into your computer.

Designing the Project

There isn’t much to this project, so it might make a good project for students who are just learning how to write a problem statement and turn it into an algorithm, then develop pseudocode.

Develop the problem statement

The problem I am solving is:

How to make a design done in LEDs blink off and on

Write the Algorithm

The algorithm involves determining if the lights are on or off, then changing them to the opposite setting

  • Forever
    • Turn lights on
    • Turn lights off

Write the Pseudocode

This is a really simple program so the pseudocode is not that much different from the algorithm. The big difference here is that I am adding a pause into the algorithm, knowing ahead of time that it’s necessary to see the image blink on and off. If you are using this for a class, it might be useful to leave that out to start and let the students determine the solution.

  • Do Forever
    • Show Light Array
    • Pause
    • Clear Light Array
    • Pause

Write and Test the Code

Here is the video tutorial of the project

Sample Code

Here is the code I wrote