查看“Rhythm Lamp”的源代码
←
Rhythm Lamp
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language| Rhythm Lamp}} {| style="width: 800px;" |- | ==Objective== Speak toward MIC, the lamp will change along with the sound rhythm. [[File:mic_sound.jpg|600px|center]] ==principle== *MIC sensor introduction MIC sensor can turn sound signal to electricity signal. It can detect sound volume but can't detect certain sound. *Rhythm Lamp Detect sound volume via MIC sensor and the system will judge which color range the sound belongs to. At the same, comparing with the pre-set trigger value and choosing to open or close light change, therefore, to control color change of the lamp. [[File:mic_sch.jpg|600px|center|thumb]] ==Equipment== {|class="wikitable" |- |Moudle||Number||Function |- |[[mCookie-CoreUSB]]||1||Core board |- |[[mCookie-Hub]]||1||Sensor pin board |- |[[Microduino-Sound]]||1||Sound detection sensor |- | [[Microduino-Color led]]||1||Colored LED light |} [[File:mic _lamp.jpg|600px|center]] ==Preparation== *Setup 1:Connect CoreUSB and PC/Mac with USB cable and open Arduino IDE. [[File:CoreUSB_Ble_pc.jpg|600px|center]] *Setup 2:Download program:[https://github.com/Microduino/Microduino_Tutorials/blob/master/MCookie_Tutorial/SHENGRI/SHENGRI.ino SHENGRI] [[File: _SHENGR.jpg|600px|center]] * Setup 3:Load code, copy program to IDE. Select the right boardcard and COM port and then download after passing the compiling. ==Program Description== *Read sound analog value (A0 pin), which can be defined by users. Then, print analog sound data via serial port monitor. <source lang="cpp"> int v=analogRead(A0); Serial.println(v); </source> *Detect sound volume every 100ms and distinguish the sound. Soudn range is defined in " zone_vol[3]", which is among 100-600. Users can change that according to personal needs. <source lang="cpp"> if(millis()-timer[0]>100) { timer[0]=millis(); if(v>zone_vol[0]) zone=0;//Red else if(v>zone_vol[1]) zone=1;//Green else if(v>zone_vol[2]) zone=2;//Blue else zone=9; } </source> *The analog value decides color combination. <source lang="cpp"> switch(zone) { case 0: if(color!=0) vol[0]=map(v,0,1023,0,255);//Red else vol[0]=10; break; case 1: if(color!=1) vol[1]=map(v,0,1023,0,255);//Green else vol[1]=10; break; case 2: if(color!=2) vol[2]=map(v,0,1023,0,255);//Blue else vol[2]=10; break; } // Some example procedures showing how to display to the pixels: colorWipe(strip.Color(vol[0],vol[1], vol[2]), 20); </source> ==Hardware Buildup== *Setup 1:Connect MIC to A0 pin of Sensorhub and Colored LED to A6. Both sides of Sensorhub have pin description, which can be connected with sensors accordingly. [[File:CoreUSB_mic_steup1.jpg|600px|center]] *Setup 2:Connect the activated battery box to BM. [[File:CoreUSB_Ble_steup2.jpg|600px|center]] *Setup 3:Stack all modules together without fixed order and finish the circuit buildup. [[File: music_mic_all.jpg|600px|center]] ==Result== Speak towards MIC and you'll find different effect. [[File:mic_colorled——legao.jpg|600px|center]] ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
Rhythm Lamp
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息