Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

サウンド検出センサ(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

cdsl
東京工科大学コンピュータサイエンス学部クラウド・分散システム研究室
https://www.tak-cslab.org/
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