Microduino Intelligent Music Box
目录[隐藏]Outline
Bill of Material
文件:Intelligent music.jpg 800px DocumentBuildupiPodtouch Package Change
文件:IPodtouch steup-1.jpg 600px
文件:IPodtouch steup-2.jpg 600px
文件:IPodtouch steup-3.jpg 600px Overall Buildup
Copy Music
The disk can be treated as a memory card you install on Audio-KEY-SD and Audio is like a card reader. 文件:Music steup-1.jpg 600px
文件:Music steup-2.jpg 600px Power-on TestDial Wheel Key ControlDial wheel key has three functions: Regulate upwards, downwards and press down, just like an old MP3. We can select corresponding menu by regulating upwards and downwards and then confirm by pressing down.
iPodtouch Control
Step 2: Set IOS device and start IOS device’s Bluetooth function. Step 3: Open LightBlue and find “Microduino” in “Peripherals Nearby” and click to connect. Step 4: LED indicator blinks 100ms every 5s after successful connection and meantime, you can see that on IOS. Slide to the bottom, and select “Characteristic 6”. Step 6: Click “HEX” on the top right and select “UTF-8 String”. 文件:Ble- HEX.png 300px 文件:Ble- UTF-8 String.png 300px Step 7: Select “Write new value”, input data you want to send and then choose “Done”/ 文件:Ble- Write.png 300px 文件:Ble- Write-1.png 300px 文件:Ble-Write-1.png 300px Program Description
iPodtouch and BT module transmit data through ble protocol. In the main program, Core+ receives data from Bluetooth and process through analysis and gives different commands to Audio module. while (mySerial.available() > 0) //Judge if there is serial port input
{
comdata += char(mySerial.read()); //Read character
delay(2); //Wait for serial port cache
}
if(comdata=="play")
audio_play();
else if(comdata=="stop")
audio_pause();
else if(comdata=="up")
audio_up();
else if(comdata=="down")
audio_down();
else if(comdata=="vol+")
audio_vol_up();
else if(comdata=="vol-")
audio_vol_down();
comdata = "";
Key detection adopts analog value to judge. Since the return values of up- and down-regulation as well as pressing down, we can tell the state from the value and execute accordingly. if (analogRead(A6)>300 && analogRead(A6)<400)
uiKeyCodeFirst = KEY_NEXT;
else if (analogRead(A6)>200 && analogRead(A6)<300)
uiKeyCodeFirst = KEY_PREV;
else if (analogRead(A6)<100)
uiKeyCodeFirst = KEY_SELECT;
else
uiKeyCodeFirst = KEY_NONE;
Note
If adopting Android device to debug, the system needs to be 4.3 or higher so that it can be communicated with BT module. You also need to download serial port communication assistant to Video |