![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
f
Dependencies: SDFileSystem VS1053 keypad mbed-rtos mbed
Revision 0:6b577ee3ce76, committed 2016-12-06
- Comitter:
- 583405000008
- Date:
- Tue Dec 06 07:25:35 2016 +0000
- Commit message:
- .
Changed in this revision
diff -r 000000000000 -r 6b577ee3ce76 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/583405000008/code/SDFileSystem/#97dac58b99ec
diff -r 000000000000 -r 6b577ee3ce76 VS1053.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VS1053.lib Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/PloyLL/code/VS1053/#ab6777568920
diff -r 000000000000 -r 6b577ee3ce76 keypad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypad.lib Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/yoonghm/code/keypad/#da060f8c03e8
diff -r 000000000000 -r 6b577ee3ce76 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,80 @@ +#include"mbed.h" +#include"player.h" +#include "rtos.h" +#include "Keypad.h" +#include<time.h> +#include<stdlib.h> +#include<string.h> + +Serial bt(PA_15,PB_7); +Player player; +Ticker t; +Timer timer; +extern Serial pc; +extern playerStatetype playerState; + +extern char listName[50][100]; //song name list +char listData[50][3]; //song data [0->like, 1->dislike, 2->skip] +char flag = 0; +char serial[50]; +char playListName[][50] = { + "Sad/Gravity.mp3", "Sad/TaTerMaiRuseuk.mp3", "Sad/NumTaTeHai.mp3", "Sad/MaTanWeLaPord.mp3", "Sad/YaSaeJaiKonDrew.mp3", + "Stress/PerJer.mp3", "Stress/YenDTMaiRuJak.mp3", "Stress/Y_Rai.mp3", "Stress/LorLey.mp3", "Stress/NuaGenPaiRuePow.mp3", + "Angry/9_Nariga.mp3", "Angry/GluptuaGlupJai.mp3", "Angry/MaiTumMaDa.mp3", "Angry/LaugPee4G.mp3", "Angry/CeakWeeSert.mp3", + "Happy/PerJer.mp3", "Happy/Jeep.mp3", "Happy/PoodTumMai.mp3", "Happy/RumSeTow.mp3", "Happy/AO.mp3" +}; +// Define your own keypad values + char Keytable[] = { '1', '2', '3', 'A', // r0 + '4', '5', '6', 'B', // r1 + '7', '8', '9', 'C', // r2 + '*', '0', '#', 'D' // r3 + }; + // c0 c1 c2 c3 +//interrupt +int num; +uint32_t buttonIndex; +uint32_t interruptButton(uint32_t index) { // swap with cbAfterInput() function from keypad. + buttonIndex = index; + flag = 1; + if(buttonIndex == 4) playerState = PS_STOP; //skip music button + return 0; + +} + +void buttonFunction(){ + //input main function in keypad and change something that resonable. + + Keypad keypad(A5, A4, D2,D3, D4, D5, D6, D7); + keypad.attach(&interruptButton); + keypad.start(); // energize the keypad via c0-c3 + +} + + +int main() { + pc.printf("go\n"); + // player.begin(); + int i=1; + while(1) + { + buttonFunction(); + num=rand()%20; + pc.printf("%d\n",num); + if(buttonIndex==1||buttonIndex==2||buttonIndex==5||buttonIndex==6){ + if(i==1){ + if(buttonIndex==1 ||buttonIndex==2||buttonIndex==5||buttonIndex==6){ + player.playFile("Angry/9_Nariga.mp3"); + i=0;pc.printf("hu\n");break; + } + } + if(buttonIndex!=buttonIndex) player.playFile(playListName[0]); + } + if(flag){ + //buttonFunction(buttonIndex); + pc.printf("next song"); + flag = 0; + + } + + } +} \ No newline at end of file
diff -r 000000000000 -r 6b577ee3ce76 mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
diff -r 000000000000 -r 6b577ee3ce76 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 06 07:25:35 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file