Skip to content

활동

Sound logger

중급 | MakeCode, Python | LED, 마이크 | 데이터 처리, 변수, 산술 연산자, 입력/출력

1단계: 만들어 보세요.

프로젝트 소개

Make a sound level logger to monitor how loud or quiet different places around you get over time

소개

프로그래밍 가이드

학습 내용

  • How to use the new micro:bit's built-in microphone sensor to measure how loud a sound is
  • Use variables and operators to track maximum values when gathering real-world data

설명

  • The new micro:bit's microphone measures sound levels in numbers between 0 and 255, just like the light sensor.
  • A loop constantly compares the current sound level with a variable maxSound storing the loudest sound. If the current sound is louder than the loudest previous sound, it resets maxSound to the new loudest sound value.
  • Inside the loop, an if statement checks if you have pressed button A. If you have, it shows the sound level number on the LED display output. You can use this to monitor how loud it gets in different places over time.
  • Reset the maximum value by pressing the reset button on the back of the micro:bit.

준비물

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

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

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

  • Modify the project so it also records the quietest, or minimum, sound level
  • Use radio to send sound levels to another micro:bit so you can monitor sound levels remotely