音量(0-255)が取得できたので音量に合わせて4から5段階に表示が変化するイコライザーを作ってください。実際は0-25くらいの値で作るとより反応がいいイコライザーになります。
from microbit import *
pattern1 = Image(
"00000:"
"00000:"
"00000:"
"00000:"
"00000:"
)
pattern2 = Image(
"00000:"
"00000:"
"00000:"
"00000:"
"99999:"
)
pattern3 = Image(
"00000:"
"00000:"
"09990:"
"99999:"
"99999:"
)
pattern4 = Image(
"00900:"
"09990:"
"99999:"
"99999:"
"99999:"
)
pattern5 = Image(
"99999:"
"99999:"
"99999:"
"99999:"
"99999:"
)
# デフォルト設定はpattern1
pattern = pattern1
while True:
# 音のレベル0-255を取得する
level = microphone.sound_level()
if level < 5 and level >= 0:
pattern = pattern1
elif level < 10 and level >= 5:
pattern = pattern2
elif level < 15 and level >= 10:
pattern = pattern3
elif level < 25 and level >= 20:
pattern = pattern4
elif level >= 25:
pattern = pattern5
# 音のレベルを表示する
display.show(pattern)