Skip to content


Sound emotion badge

Beginner | MakeCode, Python | Buttons, LED display, Speaker, Touch logo | Abstraction, Input/output

Step 1: Make it

What is it?

Make an emotion badge that expresses how you feel in sounds as well as pictures.


Coding guide

What you'll learn

  • How to use the new micro:bit's built-in sounds as outputs to add personality and expression to your projects.

How it works

  • The micro:bit with built-in speaker can play new expressive sounds. This project plays a happy sound when you press input button A to match the happy icon on the LED display output.
  • It plays a sad sound when you press button B to match the sad face icon.
  • When you press the touch logo, it plays the 'spring' sound to match the surprised face on the LED display.

What you need

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

Step 2: Code it

1from microbit import *
2import audio
4while True:
5    if button_a.is_pressed():
8    if button_b.is_pressed():
11    if pin_logo.is_touched():

Step 3: Improve it

  • Experiment with the different new expressive sounds like 'giggle', 'hello' and 'twinkle'.
  • Modify the program with different emotion icons, or draw your own.
  • Add an animation to go with each expression.