0
Help us understand the problem. What are the problem?

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
0
Help us understand the problem. What are the problem?