Skip to content

Activity

Flashing emotions

Beginner | MakeCode, Python | Buttons, LED display | Iteration

Step 1: Make it

What is it?

Make your feelings really stand out with flashing happy and sad faces.

micro:bit showing a flashing smiley face on its LED display

How it works

  • Like the Emotion badge project, this program shows different emotion images on the LED display output depending on which button input you press.
  • Loops can make sets of instructions run for ever, but here we use a numbered loop to flash the image 4 times to make it really eye-catching.
  • Loops are an important idea in computer programming as they save repeating the same code many times, making your program more efficient. This idea is also called iteration.

What you need

  • micro:bit (or MakeCode simulator)
  • MakeCode or Python editor
  • battery pack (optional)

Step 2: Code it

Step 3: Improve it

  • Make the badge flash more times by making the number 4 larger.
  • Make the flashing faster or slower by changing the delay of 200 milliseconds (0.2 seconds).
  • Make it flash forever.
  • Use different emotion images, or draw your own.