Skip to content


Disco lights

초급 | MakeCode, Python | LED, 마이크 | 입력/출력

1단계: 만들어 보세요.

프로젝트 소개

Make your own disco light show with the new micro:bit! The LED lights pulse in time to music picked up by the built-in microphone. The louder the sounds, the brighter they glow.


프로그래밍 가이드

학습 내용

  • How to use the new micro:bit's built-in microphone sensor to measure how loud a sound is
  • How to vary the brightness of the LED display output in response to sensor input readings


  • The microphone measures loudness of the sounds it picks up as numbers from 0-255. 0 is the quietest sound, 255 is the loudest.
  • All the LEDs on the display are switched on when the program starts.
  • The brightness of the LEDs can also be set using numbers from 0-255. 0 is the darkest (off) and 255 is the brightest.
  • A loop constantly sets the brightness of LEDs to match the amount of sound picked up by the microphone sensor.
  • The louder the sound, the brighter it makes the LEDs shine.
  • Flash this program on to a new micro:bit with sound, play some music with a strong beat and watch the lights pulse in time to the music!


  • new micro:bit with sound (or MakeCode simulator)
  • MakeCode 또는 Python 편집기
  • AAA 배터리 팩 (옵션)

2단계: 프로그래밍 해보세요.

3단계: 더 좋게 만들어 보세요.

  • Modify the program to use your own images or patterns
  • If you're in a class or group, flash the program on to multiple micro:bits, dim the lights, play some music and have a light show!
  • Can you make the lights get darker with louder sounds?