blue craft
/
joystick
l
Revision 0:d2654dd9b894, committed 2016-12-06
- Comitter:
- 583405000008
- Date:
- Tue Dec 06 06:59:36 2016 +0000
- Commit message:
- f;
Changed in this revision
diff -r 000000000000 -r d2654dd9b894 LCD4884.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD4884.lib Tue Dec 06 06:59:36 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/nappy009/code/LCD4884/#e0e398cab8e8
diff -r 000000000000 -r d2654dd9b894 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 06 06:59:36 2016 +0000 @@ -0,0 +1,828 @@ +#include "mbed.h" +#include "LCD4884.h" +#include "string.h" +#include "stdlib.h" +LCD4884 lcd; +Serial pc(SERIAL_TX,SERIAL_RX); +AnalogIn joy(A0); +Serial bt(PA_15,PB_7); +char buffer[2][200]; +char count[5]; +char index = 0; +char temp; +struct Cluster{ + char _like[5]; + char _dislike[5]; + char _isSkip[5]; + char _songName[200]; + char _album[50]; + + //emotion 0: Sad + //emotion 1: Stress + //emotion 2: Angry + //emotion 3: Happy +}; +typedef struct Cluster cluster; +cluster dataCollection[25]; +cluster *cp; + +void init_Cluster(){ + + cp = &dataCollection[0]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"Gravity.mp3"); + sprintf(cp->_album,"Sad"); + + cp = &dataCollection[1]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"TaTerMaiRuseuk.mp3"); + sprintf(cp->_album,"Sad"); + + cp = &dataCollection[2]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"NumTaTeHai.mp3"); + sprintf(cp->_album,"Sad"); + + cp = &dataCollection[3]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"MaTanWeLaPord.mp3"); + sprintf(cp->_album,"Sad"); + + cp = &dataCollection[4]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"YaSaeJaiKonDrew.mp3"); + sprintf(cp->_album,"Sad"); + + cp = &dataCollection[5]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"PerJer.mp3"); + sprintf(cp->_album,"Stress"); + + cp = &dataCollection[6]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"YenDTMaiRuJak.mp3"); + sprintf(cp->_album,"Stress"); + + cp = &dataCollection[7]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"Y_Rai.mp3"); + sprintf(cp->_album,"Stress"); + + cp = &dataCollection[8]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"LorLey.mp3"); + sprintf(cp->_album,"Stress"); + + cp = &dataCollection[9]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"NuaGenPaiRuePow.mp3"); + sprintf(cp->_album,"Stress"); + + cp = &dataCollection[10]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"9_Nariga.mp3"); + sprintf(cp->_album,"Angry"); + + cp = &dataCollection[11]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"GluptuaGlupJai.mp3"); + sprintf(cp->_album,"Angry"); + + cp = &dataCollection[12]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"MaiTumMaDa.mp3"); + sprintf(cp->_album,"Angry"); + + cp = &dataCollection[13]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"LaugPee4G.mp3"); + sprintf(cp->_album,"Angry"); + + cp = &dataCollection[14]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"CeakWeeSert.mp3"); + sprintf(cp->_album,"Angry"); + + cp = &dataCollection[15]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"PerJer.mp3"); + sprintf(cp->_album,"Happy"); + + cp = &dataCollection[16]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"Jeep.mp3"); + sprintf(cp->_album,"Happy"); + + cp = &dataCollection[17]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"PoodTumMai.mp3"); + sprintf(cp->_album,"Happy"); + + cp = &dataCollection[18]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"RumSeTow.mp3"); + sprintf(cp->_album,"Happy"); + + cp = &dataCollection[19]; + cp->_like[0] = 0; cp->_like[1] = 0; cp->_like[2] = 0; cp->_like[3] = 0; + cp->_dislike[0] = 0; cp->_dislike[1] = 0; cp->_dislike[2] = 0; cp->_dislike[3] = 0; + cp->_isSkip[0] = 0; cp->_isSkip[1] = 0; cp->_isSkip[2] = 0; cp->_isSkip[3] = 0; + sprintf(cp->_songName,"AO.mp3"); + sprintf(cp->_album,"Happy"); +} + + +int user(){ + float i = joy.read()*1000; + if(i>780 & i<785) {return 10;} //none + if(i<10) {return 20;} //left + if(i>760 & i<765) {return 30;} //right + if(i>950) {return 40;} //up + if(i>495 & i<505) {return 50;} //down +} +void page1(){ //page to lcd + lcd.LCD_write_string(30,0,"MENU",1); + lcd.LCD_write_string(0,1,"USER1",0); //max14 6row + } +void page21(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music1",1); //max14 6row + lcd.LCD_write_string(0,2,"Music2",0); + lcd.LCD_write_string(0,3,"Music3",0); + lcd.LCD_write_string(0,4,"Music4",0); + } +void page22(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music1",0); //max14 6row + lcd.LCD_write_string(0,2,"Music2",1); + lcd.LCD_write_string(0,3,"Music3",0); + lcd.LCD_write_string(0,4,"Music4",0); + } +void page23(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music1",0); //max14 6row + lcd.LCD_write_string(0,2,"Music2",0); + lcd.LCD_write_string(0,3,"Music3",1); + lcd.LCD_write_string(0,4,"Music4",0); + } +void page24(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music1",0); //max14 6row + lcd.LCD_write_string(0,2,"Music2",0); + lcd.LCD_write_string(0,3,"Music3",0); + lcd.LCD_write_string(0,4,"Music4",1); + } +void page25(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music5",1); //max14 6row + lcd.LCD_write_string(0,2,"Music6",0); + lcd.LCD_write_string(0,3,"Music7",0); + lcd.LCD_write_string(0,4,"Music8",0); + } +void page26(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music5",0); //max14 6row + lcd.LCD_write_string(0,2,"Music6",1); + lcd.LCD_write_string(0,3,"Music7",0); + lcd.LCD_write_string(0,4,"Music8",0); + } +void page27(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music5",0); //max14 6row + lcd.LCD_write_string(0,2,"Music6",0); + lcd.LCD_write_string(0,3,"Music7",1); + lcd.LCD_write_string(0,4,"Music8",0); + } +void page28(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music5",0); //max14 6row + lcd.LCD_write_string(0,2,"Music6",0); + lcd.LCD_write_string(0,3,"Music7",0); + lcd.LCD_write_string(0,4,"Music8",1); + } +void page29(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music9",1); //max14 6row + lcd.LCD_write_string(0,2,"Music10",0); + lcd.LCD_write_string(0,3,"Music11",0); + lcd.LCD_write_string(0,4,"Music12",0); + } +void page210(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music9",0); //max14 6row + lcd.LCD_write_string(0,2,"Music10",1); + lcd.LCD_write_string(0,3,"Music11",0); + lcd.LCD_write_string(0,4,"Music12",0); + } +void page211(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music9",0); //max14 6row + lcd.LCD_write_string(0,2,"Music10",0); + lcd.LCD_write_string(0,3,"Music11",1); + lcd.LCD_write_string(0,4,"Music12",0); + } +void page212(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music9",0); //max14 6row + lcd.LCD_write_string(0,2,"Music10",0); + lcd.LCD_write_string(0,3,"Music11",0); + lcd.LCD_write_string(0,4,"Music12",1); + } +void page213(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music13",1); //max14 6row + lcd.LCD_write_string(0,2,"Music14",0); + lcd.LCD_write_string(0,3,"Music15",0); + lcd.LCD_write_string(0,4,"Music16",0); + } +void page214(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music13",0); //max14 6row + lcd.LCD_write_string(0,2,"Music14",1); + lcd.LCD_write_string(0,3,"Music15",0); + lcd.LCD_write_string(0,4,"Music16",0); + } +void page215(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music13",0); //max14 6row + lcd.LCD_write_string(0,2,"Music14",0); + lcd.LCD_write_string(0,3,"Music15",1); + lcd.LCD_write_string(0,4,"Music16",0); + } +void page216(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music13",0); //max14 6row + lcd.LCD_write_string(0,2,"Music14",0); + lcd.LCD_write_string(0,3,"Music15",0); + lcd.LCD_write_string(0,4,"Music16",1); + } +void page217(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music17",1); //max14 6row + lcd.LCD_write_string(0,2,"Music18",0); + lcd.LCD_write_string(0,3,"Music19",0); + lcd.LCD_write_string(0,4,"Music20",0); + } +void page218(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music17",0); //max14 6row + lcd.LCD_write_string(0,2,"Music18",1); + lcd.LCD_write_string(0,3,"Music19",0); + lcd.LCD_write_string(0,4,"Music20",0); + } +void page219(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music17",0); //max14 6row + lcd.LCD_write_string(0,2,"Music18",0); + lcd.LCD_write_string(0,3,"Music19",1); + lcd.LCD_write_string(0,4,"Music20",0); + } +void page220(){ + lcd.LCD_write_string(30,0,"USER1",1); + lcd.LCD_write_string(0,1,"Music17",0); //max14 6row + lcd.LCD_write_string(0,2,"Music18",0); + lcd.LCD_write_string(0,3,"Music19",0); + lcd.LCD_write_string(0,4,"Music20",1); + } +void page31(){ +// cp = &dataCollection[songList[1]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page32(){ +// cp = &dataCollection[songList[2]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page33(){ +// cp = &dataCollection[songList[3]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page34(){ +// cp = &dataCollection[songList[4]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page35(){ +// cp = &dataCollection[songList[5]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page36(){ +// cp = &dataCollection[songList[6]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page37(){ +// cp = &dataCollection[songList[7]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page38(){ +// cp = &dataCollection[songList[8]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page39(){ +// cp = &dataCollection[songList[9]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page310(){ +// cp = &dataCollection[songList[10]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page311(){ +// cp = &dataCollection[songList[11]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page312(){ +// cp = &dataCollection[songList[12]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page313(){ +// cp = &dataCollection[songList[13]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page314(){ +// cp = &dataCollection[songList[14]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page315(){ +// cp = &dataCollection[songList[15]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page316(){ +// cp = &dataCollection[songList[16]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page317(){ +// cp = &dataCollection[songList[17]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page318(){ +// cp = &dataCollection[songList[18]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page319(){ +// cp = &dataCollection[songList[19]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +void page320(){ +// cp = &dataCollection[songList[20]]; + lcd.LCD_write_string(0,0,cp->_songName,0); + lcd.LCD_write_string(0,1,cp->_album,0); //max14 6row + lcd.LCD_write_string(0,2,cp->_like,0); + lcd.LCD_write_string(0,3,cp->_dislike,0); + lcd.LCD_write_string(0,4,cp->_isSkip,0); + } +int currentSong = -1; +char currentEmotion = '0'; +char songList[100]; +char ch; +char flag = 0; +char protocalSlot = 2; + +int main() { + //if (bt.readable()){ + // protocal = bt.scanf("%s",&protocal);} + lcd.LCD_init(); + lcd.backlight(ON); + int change=0; + int down=0; + int num=0; + while(1) + { + num = user(); + //get data from serial communicate with nucleo_master (mp3 shield). + //protocol @songIndex|Data|$ + if (bt.readable()) //change with bluetooth command [maybe: .readable()] + { + ch = bt.getc(); //change with bluetooth command + if (ch == '@'){ + index = 0; + flag = 1; + count[index] = 0; + } + else if (ch == '|' && flag){ + buffer[index][count[index]++] = '\0'; + index++; + count[index] = 0; + } + else if (ch == '$' && flag && (index == protocalSlot)){ + flag = 0; + temp = atoi(buffer[1]); + + switch(temp){ + case 0: //get new song + songList[++currentSong] = atoi(buffer[0]); + break; + + case 1: //like + cp = &dataCollection[songList[currentSong]]; + cp->_like[currentEmotion] = 1; + break; + + case 2: //dislike + cp = &dataCollection[songList[currentSong]]; + cp->_dislike[currentEmotion] = 1; + break; + + case 3: + if(currentSong !=-1){ + cp = &dataCollection[songList[currentSong]]; + cp->_isSkip[currentEmotion] = 1; + } + break; + + case 4: //emotion 0: Sad + case 5: //emotion 1: Stress + case 6: //emotion 2: Angry + case 7: //emotion 3: Happy + currentEmotion = temp - 4; + break; + } + } + else if(flag){ + if((ch<='9')&&(ch >= '0')) buffer[index][count[index]++] = ch; + else flag = 0; + } + } + } + switch(num){ + //case 10: //main page +// lcd.LCD_clear(); +// page1(); +// printf("10\n"); +// //printf("page1"); +// wait(0.75); +// break; + case 20: //left click//return main page + lcd.LCD_clear(); + page1(); + printf("20\n"); + wait(0.75); + change = 0; + down = 0; + break; + case 30: //next page1//next page2 + lcd.LCD_clear(); + printf("30\n"); + wait(0.75); + change++; + if(change==1){ //1 click//page2 + lcd.LCD_clear(); + printf("30\n"); + wait(0.75); + change++; + if(change==1){ //1 click//page2 + lcd.LCD_clear(); + page21(); + printf("page21"); + num = 50; + } + if(change==2){ //2 click//page3 + if(down==1){ + lcd.LCD_clear(); + page31(); + printf("page31"); + } + if(down==2){ + lcd.LCD_clear(); + page32(); + printf("page32"); + } + if(down==3){ + lcd.LCD_clear(); + page33(); + printf("page33"); + } + if(down==4){ + lcd.LCD_clear(); + page34(); + printf("page34"); + } + if(down==5){ + lcd.LCD_clear(); + page35(); + printf("page35"); + } + if(down==6){ + lcd.LCD_clear(); + page36(); + printf("page36"); + } + if(down==7){ + lcd.LCD_clear(); + page37(); + printf("page37"); + } + if(down==8){ + lcd.LCD_clear(); + page38(); + printf("page38"); + } + if(down==9){ + lcd.LCD_clear(); + page39(); + printf("page39"); + } + if(down==10){ + lcd.LCD_clear(); + page310(); + printf("page310"); + } + if(down==11){ + lcd.LCD_clear(); + page311(); + printf("page311"); + } + if(down==12){ + lcd.LCD_clear(); + page312(); + printf("page312"); + } + if(down==13){ + lcd.LCD_clear(); + page313(); + printf("page313"); + } + if(down==14){ + lcd.LCD_clear(); + page314(); + printf("page314"); + } + if(down==15){ + lcd.LCD_clear(); + page315(); + printf("page315"); + } + if(down==16){ + lcd.LCD_clear(); + page316(); + printf("page316"); + } + if(down==17){ + lcd.LCD_clear(); + page317(); + printf("page317"); + } + if(down==18){ + lcd.LCD_clear(); + page318(); + printf("page318"); + } + if(down==19){ + lcd.LCD_clear(); + page319(); + printf("page319"); + } + if(down==20){ + lcd.LCD_clear(); + page320(); + printf("page320"); + } + if(down==21){ + down=0; + } + } + break; + case 40: //click up + lcd.LCD_clear(); + printf("40\n"); + wait(0.75); + //if(down==1){ +// page21(); +// printf("page21"); +// } +// if(down==2){ +// page22(); +// printf("page22"); +// down=1; +// } +// if(down==3){ +// page23(); +// printf("page23"); +// down=2; +// } +// break; + case 50: //click down + lcd.LCD_clear(); + printf("50\n"); + wait(0.75); + down++; + if(change==1){ + if(down==1){ + lcd.LCD_clear(); + page21(); + printf("page21"); + } + if(down==2){ + lcd.LCD_clear(); + page22(); + printf("page22"); + } + if(down==3){ + lcd.LCD_clear(); + page23(); + printf("page23"); + } + if(down==4){ + lcd.LCD_clear(); + page24(); + printf("page24"); + } +// if(i>4 && i<9){ + if(down==5){ + lcd.LCD_clear(); + page25(); + printf("page25"); + } + if(down==6){ + lcd.LCD_clear(); + page26(); + printf("page26"); + } + if(down==7){ + lcd.LCD_clear(); + page27(); + printf("page27"); + } + if(down==8){ + lcd.LCD_clear(); + page28(); + printf("page28"); + } + if(down==9){ + lcd.LCD_clear(); + page29(); + printf("page29"); + } + if(down==10){ + lcd.LCD_clear(); + page210(); + printf("page210"); + } + if(down==11){ + lcd.LCD_clear(); + page211(); + printf("page211"); + } + if(down==12){ + lcd.LCD_clear(); + page212(); + printf("page212"); + } + if(down==13){ + lcd.LCD_clear(); + page213(); + printf("page213"); + } + if(down==14){ + lcd.LCD_clear(); + page214(); + printf("page214"); + } + if(down==15){ + lcd.LCD_clear(); + page215(); + printf("page215"); + } + if(down==16){ + lcd.LCD_clear(); + page216(); + printf("page216"); + } + if(down==17){ + lcd.LCD_clear(); + page217(); + printf("page217"); + } + if(down==18){ + lcd.LCD_clear(); + page218(); + printf("page218"); + } + if(down==19){ + lcd.LCD_clear(); + page219(); + printf("page219"); + } + if(down==20){ + lcd.LCD_clear(); + page220(); + printf("page220"); + } + if(down==21){ + down=0; + } + } + } + } +} \ No newline at end of file
diff -r 000000000000 -r d2654dd9b894 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 06 06:59:36 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file