
"""


Auteur: anonyme

Interface: microbit

Nom du projet: utiliser le microphone pour déclencher une action

Description: No-description

Toolbox: vittascience

Mode: mixed

Blocks: <xml xmlns="https://developers.google.com/blockly/xml"><block type="on_start" id="G[=T#8yqB70`NFgYq}GP" deletable="false" x="-438" y="88"></block><block type="forever" id="o[WN]+eeF.OUxGch67@8" x="-88" y="112"><statement name="DO"><block type="clear" id=".g]4f]hpE,zftN(a6sc~"><next><block type="controls_if" id=":~@*kS=#.E0OxwQ!vq-;"><mutation else="1"></mutation><value name="IF0"><block type="logic_compare" id="Q{aHefAZi4awST3Jzqm="><field name="OP">LT</field><value name="A"><block type="io_micro_getSoundLevel" id="l$N4apl;JfD6B%#~kDYj"></block></value><value name="B"><shadow type="math_number" id=")(zhh/G-4qV`TWav=I@C"><field name="NUM">80</field></shadow></value></block></value><statement name="DO0"><block type="show_icon" id="2DwKUX*xlQ:B.;[t5!g9"><field name="ICON">HAPPY</field><next><block type="io_pause" id="M5kkzdqs;`vb?wzG5~V|"><field name="UNIT">SECOND</field><value name="TIME"><shadow type="math_number" id="9Dj[^GNlnEiQoi7_!#Wv"><field name="NUM">1</field></shadow></value></block></next></block></statement><statement name="ELSE"><block type="show_number" id="VR_kSjC07~O](w7Bah|)"><value name="VALUE"><shadow type="text" id="+Vh!S/EN[w,Tw6M9CDTK"><field name="TEXT">Trop fort</field></shadow></value><next><block type="io_pause" id="_sh=XM~D};-QT-[Adg4n"><field name="UNIT">SECOND</field><value name="TIME"><shadow type="math_number" id="n|P;K`)w4kygr7D*F{05"><field name="NUM">1</field></shadow></value></block></next></block></statement></block></next></block></statement></block></xml>

Projet généré par Vittascience.

Ce fichier contient le code textuel ainsi que le code blocs. Il peut être importé de nouveau

sur l'interface http://vittascience.com/microbit


"""

from microbit import *
import utime

while True:
  display.clear()
  if microphone.sound_level() < 80:
    display.show(Image.HAPPY)
    utime.sleep(1)
  else:
    display.show('Trop fort')
    utime.sleep(1)
