0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

今回は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

0
0
0

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
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?