查看“Noise Alarm”的源代码
←
Noise Alarm
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language|Noise Alarm}} {| style="width: 800px;" |- | ==Objective== When noise reaches a certain value around you, the alarm goes off. ==Principle== ==Equipment== {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-CoreUSB]]||1||Core board |- |[[Microduino-Sensorhub]]||1||Sensor pinboard |- |[[Microduino-Mic]]||1||Sound detection sensor |- |[[Microduino-Crash]]||1||Crash/touch switch |- |[[Microduino-BUZZER]]||1||Buzzer sensor |- | [[Microduino-BM]]||1||Battery management |} [[File: Noise_alarm.jpg|600px|center|thumb]] ==Hardware Buildup== *Setup 1:Connect CoreUSB to your PC, open program example, choose the right board and download program via the serial port. [[File: Noise_alarm_setup_1.jpg|600px|center|thumb]] *Setup2:Connect Mic to the A0 pin of Sensorhub, buzzer to D6 and crash sensor to D4. [[file:Microduino-sensorhub_rule.JPG|thumb|800px|center]] [[file: Noise_alarm_sensor.JPG|thumb|800px|center]] *Setup6:Connect battery to BM. [[file: Noise_alarm _bm.JPG|thumb|800px|center]] ==Software Debugging== *Build IDE, connect CoreUSB to your PC and download program code. [https://github.com/Microduino/Microduino_Tutorials/blob/master/MCookie_Tutorial/Noise_alarm/Noise_alarm.ino Noise_alarm] Code description *Control pin description <source lang="cpp"> #define mic_pin A0 #define buzzer_pin 6 #define key_pin 4 </source> *Sound pre-set value <source lang="cpp"> #define voice 400 </source> *If the sound value is greater than the preset value in one second, then the buzzer will give an alarm. <source lang="cpp"> if (voice_data > voice) { if (millis() - time > 1000 ) { voice_data = analogRead(mic_pin); if (voice_data > voice) { buzzer_speak = true; i = 200; } time = millis(); } } </source> *Touch the key to close the sound. <source lang="cpp"> if (key_get(key_pin, 0)) { delay(200); buzzer_speak = false; time = millis(); } </source> ==Result== If the sound around you exceeds the default value within one second, the alarm will go off. You can press the key and close the sound. (You can also build a beautiful cover with LEGO.) ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
Noise Alarm
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息