当前位置:网站首页>Raspberry pie 4B sound sensor do module
Raspberry pie 4B sound sensor do module
2022-07-21 21:59:00 【Programmer__ C】
DOUT:Digital Out( Digital output )
AOUT:Analog Out( Analog output )
GND: Grounding
VCC: Positive pole
( Not used in this article AOUT connection )【 The cross knob on the top can be used to adjust the sound sensitivity 】
step :
(1)VCC Connect to raspberry pie 3.3V perhaps 5V Pin
(2)GND Connect to raspberry pie GND Pin
(3)DOUT Connect to any GPIO Interface
As shown in the figure
Red thread (VCC) Connect pin 1 (3V3 power)
Black line (GND) Connect pin 6 (Ground)
The yellow line (DOUT) Connect pin 3 GPIO 2(SDA)
matters needing attention : Not recommended GPIO-2 and GPIO-3, The following code uses GPIO-4
import time
import RPi.GPIO as GPIO
""" Specify the numbering sequence as BOARD"""
GPIO.setmode(GPIO.BOARD)
# Define the sensor connection GPIO Pin for 4
sound=4## Totally wrong
#2 yes GPIO code , Use here BOARD Coding pin , Look-up table is GPIO 2 Corresponding BOARD In coding 7[ Same as physical code ]
sound=7# correct
# Appoint 2 No. pin mode is output mode
# By default, it is pulled high , Low level means OUT Mouth has output
GPIO.setup(sound,GPIO.IN,pull_up_down=GPIO.PUD_UP)
try :
while True:
# Check whether the sound sensor module has output low level
print(GPIO.input(sound))
if c==0:
print(" Sound detected ")
time.sleep(0.2)
except KeyboardInterrupt:
print(" Stop testing ")
finally :
GPIO.cleanup()
边栏推荐
猜你喜欢
超级详细-NMOS、PMOS的工作原理及相关内容整理(上)
基于层次化强化学习的任务型对话诊断系统 Task-oriented Dialogue System for Automatic Disease Diagnosis via HRL
ARMv8 Cortex-a 编程向导手册学习_5
[sentence interactive reprint] 1 Trend analysis of dialogue system
[RPG maker MV] usage skill 1: use the picture you draw as a map
Supervised Discrete Hashing
Realtek USB无线网卡能搜到WiFi 无法连接到网络
Alibaba cloud machine learning platform Pai paper efficient big model training framework whale was selected in USENIX ATC '22
ARM的工作模式以及寄存器组织(回顾复习)
ARMv8 Cortex-a 编程向导手册学习_4
随机推荐
The first batch in China! Alibaba cloud's native data Lake products have passed the evaluation and certification of the ICT Institute
Thesis navigation
Alibaba's super large-scale Flink cluster operation and maintenance practice
[RPG maker MV] usage skill 1: use the picture you draw as a map
编译时缺少sigset.h xlocal.h huge_val.h等解决办法
ARM的工作模式以及寄存器组织(回顾复习)
WiFi slam package configuration record
树莓派 4B 使用拓展板的四声音传感器AO模块连接
【半导体先进工艺制程技术系列】FinFET工艺流程
【半导体先进工艺制程技术系列】FinFET和UTB-SOI简介
UWB环境配置记录
Nimble Bluetooth development I: overview of ble Bluetooth host specification
进制转换
Realtek USB无线网卡能搜到WiFi 无法连接到网络
[paper translation] [2015] [28] Bayesian estimation of the Dina model with Gibbs sampling (Bayesian parameter estimation method of Dina model based on Gibbs sampling)
树莓派4B 声音传感器AO模块
Nimble development platform based on ms-rtos
Introduction to the study of care-gnn thesis
Natural Supervised Hashing
15 in-depth articles that developers can't miss when playing with machine learning