LoginSignup
0

More than 1 year has passed since last update.

サウンド検出センサ(FC-04)の音の検出

今回はFC-04の音の検出の仕方を紹介します。

sound()を呼び出すと音の検知をする度に1を出力し、音の検知が無い時は0を出力します。

soundsenser.py
from machine import Pin
from utime import sleep

# LED出力
p5 = Pin(5, Pin.OUT)

# 音の検知
p23 = Pin(23, Pin.IN)

p5.off()

def sound():

    while True:
        if p23.value() == 1:
            p5.on()
        else:
            p5.off()
        print(p23.value())
        sleep(0.01)
        #count +=1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0