2024.09.20 센텀고 정보 소음 감지기
본문
[code]
# Imports go at the top
from microbit import *
led_image1 = Image("11111:11111:11111:11111:11111")
led_image2 = Image("55555:55555:55555:55555:55555")
led_image3 = Image("99999:99999:99999:99999:99999")
while True:
sound_level = microphone.sound_level()
if sound_level < 50:
display.show(led_image1)
if 150 > sound_level > 100:
display.show(led_image2)
if sound_level > 150:
display.show(led_image3)
[/code]
[code]
# Imports go at the top
from microbit import *
led_image1 = Image("11111:11111:11111:11111:11111")
led_image2 = Image("55555:55555:55555:55555:55555")
led_image3 = Image("99999:99999:99999:99999:99999")
while True:
sound_level = microphone.sound_level()
if sound_level < 86:
display.show(led_image1)
elif 86 < sound_level > 170:
display.show(led_image2)
[/code]
#마이크로비트 #파이썬
등록된 댓글이 없습니다.