Skip to content


Sound meter

Débutant | MakeCode, Python | Microphone, Écran LED | Entrée / Sortie, Gestion des données

Étape 1 : Fais-le

Qu'est-ce que c'est ?

Measure how noisy it is around you using the new micro:bit's microphone sensor and a simple bar chart display.


Guide de codage

Ce que vous apprendrez

  • How to use the new micro:bit's built-in microphone input sensor to measure how loud sounds are around you
  • How to display numerical data from input sensors graphically on the LED display output

Comment ça marche

  • The new micro:bit's microphone measures sound levels in numbers between 0 and 255. 0 is the quietest and 255 is the loudest sound measurement it can make.
  • The code uses a forever loop to keep the microphone measuring sound levels and plotting a bar graph on the LED display.
  • The louder the sounds measured, the higher the bar graph gets.

Ce dont vous aurez besoin

  • nouveau micro:bit avec son (ou simulateur MakeCode)
  • MakeCode ou éditeur Python
  • un boîtier de piles (optionnel)

Étape 2 : Codez

Étape 3 : Améliorez

  • Create your own ways of displaying how loud a sound is, for example showing different emojis depending on how loud it is
  • Make a visual noise alarm that only flashes when the sound goes over a certain level - you could use this to help keep your classroom peaceful