查看“Microduino Butterfly Light”的源代码
←
Microduino Butterfly Light
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Outline== *Project: Butterfly light *Purpose: Butterfly light is a touch control color-changing music light. *Difficulty: Middle-level *Time-consuming: 6-Hour *Maker: Guysgogo&&Microduino ==Team Introduction== [[File:setup_gusgogo_logo.jpg|80px|right|thumb]] Guysgogo is team composed of four senior students in the maker class of LKK Intelligent Hardware Industrial Design. Three of the students—Run Jiang, Huiyu Hao, Tingyu Li and Chaohui Xie, are college students from Hebei. |- | |- | |- | ==Bill of Material== *Microduino Equipment {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-Core+]]||1||Core board |- |[[Microduino-USBTTL ]]||1||Program download |- |[[Microduino-Audio]] ||1||Audio control |- |[[Microduino-Amplifier]] ||1||Amplifier module |- |[[Microduino-Sensorhub]] ||1||Sensor connection board |- |[[Microduino-Cube-S1]] ||1||Base board |- |[[Microduino-Lantern]] ||7||Colorful LED light |- |[[Microduino-Touch]] ||7||Touch sensor |} *Other Equipment {|class="wikitable" |- |Equipment||Number||Function |- |Loudspeaker||1|| |- |MicroUSB cable||1||Power supply |} ==Document== Program download: [https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced_Tutorial/Butterfly_light Butterfly_light] 3D model download: '''[[File:3D-Butterfly light.zip]]''' ==Build 3D Model== The model adopts buttery shape. [[File:3dm_light1.jpg|600px|center|thumb]] ==Build Hardware Circuit== *The colorful LED light adopts built-in IC control chip. With one-wire bus control, you only need one I/O port to control. Just connect the OUT interface of one Lantern to the IN interface of the other Lantern, and then join up the IN interface to Microduino core board via Sensorhub. [[File:light_steup.jpg|600px|center|thumb]] *Each touch sensor needs a Microduino I/O port to drive. We can tell if it is pressed by reading sensor values via digital port and analog port. [[File:Touch_steup.jpg|600px|center|thumb]] *You can debug software after building the hardware circuit. ==Prepare Audio== *Download audio file:'''[[File:Music-Butterfly light.zip]]''' *Connect Microduino-Audio module with your computer via USB cable. It will show a disk named “microduino” after successful connection. Just open the disk and select audio file, then write to flash. ==Software Debugging== ===Program Description=== *“audio.h”file is used for music play control and “key.h” file is for touch detection. **Audio module is connected to Serial 1 to control by default. **As for touch sensor pin definition, users can change according to personal needs: <source lang="cpp"> int sensor_pin[7]= { 4,8,10,12,A0,A2,A6 }; </source> **The colored LED light defines seven lights, whose light control pin is D6: <source lang="cpp"> #define PIN 6 Adafruit_NeoPixel strip = Adafruit_NeoPixel(7, PIN, NEO_GRB + NEO_KHZ800); </source> *How to judge the touch of seven lights & how to control music and LED lights: **When pressing some a button, it will play music and the white led light will blink. **When pressing twice one time, the white led will go on. **When pressing three times once, you can change the light color. **Anytime, one press means turning off the light. <source lang="cpp"> for(int a=0;a<7;a++) { { if(key_get(sensor_pin[a],1)) //When triggered, { //colorWipe(strip.Color(255, 255, 0), 10); sensor_vol_cache[a]++; //Counting // Serial.print("+"); if(sensor_vol_cache[a]>3) sensor_vol_cache[a]=3; { colorWipe(color[8], a); num=a; audio_choose(a+1); audio_play(); colorWipe(color[0], a); } time1[a]=millis(); } if(millis()-time1[a]>500 && sensor_vol_cache[a]!=0) //Just start it and delay for one second or more, and the scan is ended. { if(sensor_vol_cache[a]==1) { colorWipe(color[0], a); Serial.println("LED_OFF"); } else if(sensor_vol_cache[a]==2) { colorWipe(color[8], a); } else { randomSeed(millis()%1000); sensor_vol[a]=random(1,7); Serial.println(""); Serial.print("num:"); Serial.print(a); Serial.print(":"); Serial.print(sensor_vol[a]); colorWipe(color[sensor_vol[a]], a); } sensor_vol_cache[a]=0; //Return to zero and wait for the next scan. } } } </source> ===Program Download=== *Make sure you build Microduino IDE, or you can refer to: *Make there is _99_LCD_NeoPixel library in IDE. *Open the downloaded program and select the right board to download after compiling. *After the download, you can test whether the function mentioned above is right or not by the Touch sensor. Meantime, you need to notice which LED light the Touch sensor corresponds to. ==Overall Assembling== *Fixate the light and the touch sensor on the outside of the 3D battery. [[File:setup_3d_light1.jpg|600px|center|thumb]] [[File:setup_3d_light2.jpg|600px|center|thumb]] *Wrap the battery with a beautiful exterior. [[File:setup_3d_page.jpg|600px|center|thumb]] *Fixate the loudspeaker on the base and then get it fixated with the battery. [[File:setup_3d_buzzer.jpg|600px|center|thumb]] *Plug in USB cable for power supply at last and have fun! [[File:setup_3d_ok1.jpg|600px|center|thumb]] [[File:setup_3d_ok2.jpg|600px|center|thumb]] ==Notice== *Since Audio adopts Serial 1 by default, please initialize Serial 1: “AUDIO_PORT.begin(9600);” *Please make sure the touch sensor corresponding with the lights. ==Video== http://v.youku.com/v_show/id_XODc2NDMzODg4.html |}
返回至
Microduino Butterfly Light
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息