help :(

Dependencies:   FFT

Committer:
dimitryjl23
Date:
Fri Dec 04 07:32:34 2020 +0000
Revision:
9:97abd5e954f1
Parent:
8:24c18eecc442
Child:
10:a259a4a70210
it works

Who changed what in which revision?

UserRevisionLine numberNew contents of line
annieluo2 0:d6c9b09b4042 1 #include "mbed.h"
annieluo2 0:d6c9b09b4042 2 #include "SDFileSystem.h"
annieluo2 0:d6c9b09b4042 3 #include "wave_player.h"
annieluo2 0:d6c9b09b4042 4 #include "Adafruit_LEDBackpack.h"
annieluo2 0:d6c9b09b4042 5 #include "Adafruit_GFX.h"
annieluo2 0:d6c9b09b4042 6 #include "rtos.h"
annieluo2 0:d6c9b09b4042 7 #include "FFT.h"
shyamgatech 5:598d94b45bad 8 #include <string>
dimitryjl23 8:24c18eecc442 9 #include "around_the_world-atc-array.h"
dimitryjl23 8:24c18eecc442 10 #include "dont_speak-no_doubt-array.h"
dimitryjl23 8:24c18eecc442 11 #include "my-love-array.h"
annieluo2 0:d6c9b09b4042 12
annieluo2 0:d6c9b09b4042 13 SDFileSystem sd(p5, p6, p7, p8, "sd"); // SD card
annieluo2 0:d6c9b09b4042 14
shyamgatech 5:598d94b45bad 15 I2C i2c(p28, p27); // LED display
annieluo2 0:d6c9b09b4042 16 Adafruit_8x8matrix matrix = Adafruit_8x8matrix(&i2c);
annieluo2 0:d6c9b09b4042 17
annieluo2 0:d6c9b09b4042 18 AnalogOut DACout(p18); // speaker
annieluo2 0:d6c9b09b4042 19 wave_player waver(&DACout);
annieluo2 0:d6c9b09b4042 20 Mutex speaker_lock;
dimitryjl23 8:24c18eecc442 21 Mutex file_lock;
dimitryjl23 2:a6e81c45ef48 22 DigitalOut myled(LED1); // mbed LED
dimitryjl23 2:a6e81c45ef48 23 Serial pc (USBTX,USBRX);
shyamgatech 5:598d94b45bad 24 string dir; // "/sd/" + song + ".wav"
dimitryjl23 8:24c18eecc442 25 //string song = "around_the_world-atc";
shyamgatech 5:598d94b45bad 26 string song;
dimitryjl23 8:24c18eecc442 27 int song_data_length;
dimitryjl23 9:97abd5e954f1 28 const unsigned short *song_data;
dimitryjl23 8:24c18eecc442 29 bool play = false;
annieluo2 0:d6c9b09b4042 30
annieluo2 0:d6c9b09b4042 31
annieluo2 1:5dd6801bb0d6 32 // delete later
dimitryjl23 2:a6e81c45ef48 33 /*int sample[12][8] = {
shyamgatech 5:598d94b45bad 34 34085,32666,29810,29823,27514,24175,24468,32559,
shyamgatech 5:598d94b45bad 35 36401,33075,29037,21933,20189,21751,20975,20087,
shyamgatech 5:598d94b45bad 36 17530,27723,30891,21128,19982,15446,12413,13597,
shyamgatech 5:598d94b45bad 37 15776,14233,15622,16334,15485,17136,16389,17954,
shyamgatech 5:598d94b45bad 38 20349,18486,23377,34447,34400,34681,33107,31171,
shyamgatech 5:598d94b45bad 39 30007,33640,37007,38136,39187,38169,51831,52041,
shyamgatech 5:598d94b45bad 40 47831,48634,44189,43878,44743,46468,43170,47172,
shyamgatech 5:598d94b45bad 41 53518,52294,54825,51992,49619,48147,47901,48413,
shyamgatech 5:598d94b45bad 42 46049,49090,47590,46154,45423,41223,41782,54695,
shyamgatech 5:598d94b45bad 43 57452,51210,52462,59096,56711,52268,49364,42865,
shyamgatech 5:598d94b45bad 44 41483,37964,39215,35908,31570,28332,24492,23121,
annieluo2 1:5dd6801bb0d6 45 22874,18154,15541,15263,12463,12198,13301,9951
dimitryjl23 2:a6e81c45ef48 46 };*/
dimitryjl23 8:24c18eecc442 47
dimitryjl23 8:24c18eecc442 48
annieluo2 3:3dbf078989b1 49 #define BUFFER_SIZE 64
annieluo2 1:5dd6801bb0d6 50
annieluo2 1:5dd6801bb0d6 51 // states for display output
shyamgatech 5:598d94b45bad 52 const int on[8][8] = {
shyamgatech 5:598d94b45bad 53 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 54 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 55 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 56 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 57 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 58 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 59 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 60 1, 1, 1, 1, 1, 1, 1, 1
shyamgatech 5:598d94b45bad 61 };
annieluo2 1:5dd6801bb0d6 62
shyamgatech 5:598d94b45bad 63 const int high[8][8] = {
shyamgatech 5:598d94b45bad 64 0, 0, 0, 1, 1, 0, 0, 0,
shyamgatech 5:598d94b45bad 65 0, 0, 0, 1, 1, 0, 0, 0,
shyamgatech 5:598d94b45bad 66 0, 0, 1, 1, 1, 1, 0, 0,
shyamgatech 5:598d94b45bad 67 0, 1, 1, 1, 1, 1, 1, 0,
shyamgatech 5:598d94b45bad 68 0, 1, 1, 1, 1, 1, 1, 0,
shyamgatech 5:598d94b45bad 69 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 70 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 71 1, 1, 1, 1, 1, 1, 1, 1
shyamgatech 5:598d94b45bad 72 };
annieluo2 1:5dd6801bb0d6 73
shyamgatech 5:598d94b45bad 74 const int med[8][8] = {
shyamgatech 5:598d94b45bad 75 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 76 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 77 0, 0, 0, 1, 1, 0, 0, 0,
shyamgatech 5:598d94b45bad 78 0, 0, 1, 1, 1, 1, 0, 0,
shyamgatech 5:598d94b45bad 79 0, 0, 1, 1, 1, 1, 0, 0,
shyamgatech 5:598d94b45bad 80 0, 1, 1, 1, 1, 1, 1, 0,
shyamgatech 5:598d94b45bad 81 1, 1, 1, 1, 1, 1, 1, 1,
shyamgatech 5:598d94b45bad 82 1, 1, 1, 1, 1, 1, 1, 1
shyamgatech 5:598d94b45bad 83 };
annieluo2 1:5dd6801bb0d6 84
shyamgatech 5:598d94b45bad 85 const int low[8][8] = {
shyamgatech 5:598d94b45bad 86 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 87 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 88 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 89 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 90 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 91 0, 0, 1, 1, 1, 1, 0, 0,
shyamgatech 5:598d94b45bad 92 0, 1, 1, 1, 1, 1, 1, 0,
shyamgatech 5:598d94b45bad 93 1, 1, 1, 1, 1, 1, 1, 1
shyamgatech 5:598d94b45bad 94 };
annieluo2 1:5dd6801bb0d6 95
shyamgatech 5:598d94b45bad 96 const int off[8][8] = {
shyamgatech 5:598d94b45bad 97 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 98 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 99 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 100 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 101 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 102 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 103 0, 0, 0, 0, 0, 0, 0, 0,
shyamgatech 5:598d94b45bad 104 0, 0, 0, 0, 0, 0, 0, 0
shyamgatech 5:598d94b45bad 105 };
annieluo2 1:5dd6801bb0d6 106
dimitryjl23 2:a6e81c45ef48 107
dimitryjl23 2:a6e81c45ef48 108
dimitryjl23 8:24c18eecc442 109
dimitryjl23 8:24c18eecc442 110 void display_fft(float sample[])
shyamgatech 5:598d94b45bad 111 {
shyamgatech 5:598d94b45bad 112
annieluo2 1:5dd6801bb0d6 113 int state = 0;
annieluo2 3:3dbf078989b1 114 float freq = 0;
annieluo2 1:5dd6801bb0d6 115 matrix.begin(0x70);
shyamgatech 5:598d94b45bad 116
shyamgatech 5:598d94b45bad 117
dimitryjl23 8:24c18eecc442 118 // for (int a = 0; a < 64; a++) {
dimitryjl23 9:97abd5e954f1 119
dimitryjl23 9:97abd5e954f1 120
dimitryjl23 8:24c18eecc442 121
dimitryjl23 8:24c18eecc442 122 freq = sample[1]/4;
dimitryjl23 9:97abd5e954f1 123
dimitryjl23 8:24c18eecc442 124
dimitryjl23 8:24c18eecc442 125 //pc.printf("%f\n",freq);
dimitryjl23 8:24c18eecc442 126
dimitryjl23 8:24c18eecc442 127 // determine state based on the FFT output range
dimitryjl23 8:24c18eecc442 128 if (freq < 10000) {
dimitryjl23 8:24c18eecc442 129 state = 5; // OFF
dimitryjl23 8:24c18eecc442 130 } else if (freq >= 10000 && freq < 25000) {
dimitryjl23 8:24c18eecc442 131 state = 4; // LOW
dimitryjl23 8:24c18eecc442 132 } else if (freq >= 25000 && freq < 40000) {
dimitryjl23 8:24c18eecc442 133 state = 3; // MED
dimitryjl23 8:24c18eecc442 134 } else if (freq >= 40000 && freq < 55000) {
dimitryjl23 8:24c18eecc442 135 state = 2; // HIGH
dimitryjl23 8:24c18eecc442 136 } else if (freq >= 55000) {
dimitryjl23 8:24c18eecc442 137 state = 1; // ON
dimitryjl23 8:24c18eecc442 138 }
shyamgatech 5:598d94b45bad 139
dimitryjl23 8:24c18eecc442 140 // switch statement based on the state
dimitryjl23 8:24c18eecc442 141 switch (state) {
dimitryjl23 8:24c18eecc442 142 case(1): // CASE HIGHEST
dimitryjl23 8:24c18eecc442 143 matrix.clear();
dimitryjl23 8:24c18eecc442 144 for (int i = 0; i < 8; i++) {
dimitryjl23 8:24c18eecc442 145 for (int j = 0; j < 8; j++) {
dimitryjl23 8:24c18eecc442 146 if (on[i][j] == 1) {
dimitryjl23 8:24c18eecc442 147 matrix.drawPixel(i, j, LED_ON);
dimitryjl23 8:24c18eecc442 148 }
dimitryjl23 8:24c18eecc442 149 }
dimitryjl23 8:24c18eecc442 150 }
dimitryjl23 8:24c18eecc442 151 matrix.writeDisplay();
dimitryjl23 9:97abd5e954f1 152 Thread::wait(50);
dimitryjl23 9:97abd5e954f1 153 //wait(.15);
dimitryjl23 8:24c18eecc442 154 break;
dimitryjl23 8:24c18eecc442 155
dimitryjl23 8:24c18eecc442 156 case(2): // CASE HIGH
dimitryjl23 8:24c18eecc442 157 matrix.clear();
dimitryjl23 8:24c18eecc442 158 for (int i = 0; i < 8; i++) {
dimitryjl23 8:24c18eecc442 159 for (int j = 0; j < 8; j++) {
dimitryjl23 8:24c18eecc442 160 if (high[i][j] == 1) {
dimitryjl23 8:24c18eecc442 161 matrix.drawPixel(i, j, LED_ON);
annieluo2 1:5dd6801bb0d6 162 }
annieluo2 1:5dd6801bb0d6 163 }
dimitryjl23 8:24c18eecc442 164 }
dimitryjl23 8:24c18eecc442 165 matrix.writeDisplay();
dimitryjl23 9:97abd5e954f1 166 Thread::wait(50);
dimitryjl23 9:97abd5e954f1 167 //wait(.15);
dimitryjl23 8:24c18eecc442 168
dimitryjl23 8:24c18eecc442 169
shyamgatech 5:598d94b45bad 170
dimitryjl23 8:24c18eecc442 171 case(3): // CASE MEDIUM
dimitryjl23 8:24c18eecc442 172 matrix.clear();
dimitryjl23 8:24c18eecc442 173 for (int i = 0; i < 8; i++) {
dimitryjl23 8:24c18eecc442 174 for (int j = 0; j < 8; j++) {
dimitryjl23 8:24c18eecc442 175 if (med[i][j] == 1) {
dimitryjl23 8:24c18eecc442 176 matrix.drawPixel(i, j, LED_ON);
annieluo2 1:5dd6801bb0d6 177 }
annieluo2 1:5dd6801bb0d6 178 }
dimitryjl23 8:24c18eecc442 179 }
dimitryjl23 8:24c18eecc442 180 matrix.writeDisplay();
dimitryjl23 9:97abd5e954f1 181 Thread::wait(50);
dimitryjl23 9:97abd5e954f1 182 //wait(.15);
dimitryjl23 8:24c18eecc442 183 break;
shyamgatech 5:598d94b45bad 184
dimitryjl23 8:24c18eecc442 185 case(4): // CASE LOW
dimitryjl23 8:24c18eecc442 186 matrix.clear();
dimitryjl23 8:24c18eecc442 187 for (int i = 0; i < 8; i++) {
dimitryjl23 8:24c18eecc442 188 for (int j = 0; j < 8; j++) {
dimitryjl23 8:24c18eecc442 189 if (low[i][j] == 1) {
dimitryjl23 8:24c18eecc442 190 matrix.drawPixel(i, j, LED_ON);
annieluo2 1:5dd6801bb0d6 191 }
annieluo2 1:5dd6801bb0d6 192 }
dimitryjl23 8:24c18eecc442 193 }
dimitryjl23 8:24c18eecc442 194 matrix.writeDisplay();
dimitryjl23 9:97abd5e954f1 195 Thread::wait(50);
dimitryjl23 8:24c18eecc442 196 break;
shyamgatech 5:598d94b45bad 197
dimitryjl23 8:24c18eecc442 198 case(5): // CASE OFF
dimitryjl23 8:24c18eecc442 199 matrix.clear();
dimitryjl23 8:24c18eecc442 200 for (int i = 0; i < 8; i++) {
dimitryjl23 8:24c18eecc442 201 for (int j = 0; j < 8; j++) {
dimitryjl23 8:24c18eecc442 202 if (off[i][j] == 1) {
dimitryjl23 8:24c18eecc442 203 matrix.drawPixel(i, j, LED_ON);
annieluo2 1:5dd6801bb0d6 204 }
annieluo2 1:5dd6801bb0d6 205 }
dimitryjl23 8:24c18eecc442 206 }
dimitryjl23 8:24c18eecc442 207 matrix.writeDisplay();
dimitryjl23 9:97abd5e954f1 208 Thread::wait(50);
dimitryjl23 9:97abd5e954f1 209 //wait(.15);
dimitryjl23 8:24c18eecc442 210 break;
shyamgatech 5:598d94b45bad 211
dimitryjl23 8:24c18eecc442 212 default:
dimitryjl23 8:24c18eecc442 213 break;
shyamgatech 5:598d94b45bad 214 }
shyamgatech 5:598d94b45bad 215
dimitryjl23 8:24c18eecc442 216 //}
dimitryjl23 8:24c18eecc442 217
dimitryjl23 8:24c18eecc442 218 //pc.printf("done");
dimitryjl23 8:24c18eecc442 219
dimitryjl23 2:a6e81c45ef48 220 }
dimitryjl23 2:a6e81c45ef48 221
dimitryjl23 2:a6e81c45ef48 222 //Reads SD card and passes value to frequency display
dimitryjl23 2:a6e81c45ef48 223 void display_thread(void const* args)
dimitryjl23 2:a6e81c45ef48 224 {
dimitryjl23 8:24c18eecc442 225 while(1) {
shyamgatech 5:598d94b45bad 226
dimitryjl23 8:24c18eecc442 227 float buffer[BUFFER_SIZE];
dimitryjl23 8:24c18eecc442 228 int buffer_index = 0;
dimitryjl23 9:97abd5e954f1 229 int song_array_index = 0;
dimitryjl23 9:97abd5e954f1 230 if(play) {
dimitryjl23 9:97abd5e954f1 231 //int num_elements = NUM_ELEMENTS_AROUND_THE_WORLD;
dimitryjl23 9:97abd5e954f1 232 while(play && song_array_index < song_data_length) {
dimitryjl23 9:97abd5e954f1 233 buffer[buffer_index] = song_data[song_array_index];
dimitryjl23 9:97abd5e954f1 234 song_array_index++;
dimitryjl23 9:97abd5e954f1 235 // pc.printf("%f", buffer[buffer_index]);
dimitryjl23 9:97abd5e954f1 236 buffer_index++;
dimitryjl23 9:97abd5e954f1 237 //pc.printf("%d\n",value);
dimitryjl23 9:97abd5e954f1 238 //buffer_index++;
dimitryjl23 9:97abd5e954f1 239 if(buffer_index == BUFFER_SIZE) {
dimitryjl23 9:97abd5e954f1 240 //fast fourier tranform function here
dimitryjl23 9:97abd5e954f1 241 vRealFFT(buffer, 4);
dimitryjl23 9:97abd5e954f1 242 display_fft(buffer);
dimitryjl23 9:97abd5e954f1 243 buffer_index = 0;
dimitryjl23 9:97abd5e954f1 244 memset(buffer,0,sizeof(buffer));
dimitryjl23 9:97abd5e954f1 245
dimitryjl23 9:97abd5e954f1 246 }
dimitryjl23 8:24c18eecc442 247
dimitryjl23 8:24c18eecc442 248 }
shyamgatech 5:598d94b45bad 249 }
dimitryjl23 8:24c18eecc442 250 Thread::wait(300);
dimitryjl23 2:a6e81c45ef48 251 }
shyamgatech 5:598d94b45bad 252
annieluo2 0:d6c9b09b4042 253 }
annieluo2 0:d6c9b09b4042 254
annieluo2 0:d6c9b09b4042 255 void speaker_thread(void const* args)
annieluo2 0:d6c9b09b4042 256 {
shyamgatech 5:598d94b45bad 257 while(1) {
annieluo2 1:5dd6801bb0d6 258 // check helper function for new song in GUI
annieluo2 0:d6c9b09b4042 259 // grab file here and put together string
annieluo2 0:d6c9b09b4042 260 // string song_title = "/sd/" + "" + ".wav";
shyamgatech 5:598d94b45bad 261
shyamgatech 5:598d94b45bad 262
dimitryjl23 9:97abd5e954f1 263 if(play == true) {
dimitryjl23 9:97abd5e954f1 264 speaker_lock.lock();
dimitryjl23 9:97abd5e954f1 265 FILE *wave_file;
dimitryjl23 9:97abd5e954f1 266 dir = "/sd/" + song + ".wav";
dimitryjl23 9:97abd5e954f1 267
dimitryjl23 9:97abd5e954f1 268 file_lock.lock();
dimitryjl23 9:97abd5e954f1 269 wave_file=fopen(dir.c_str(),"r");
dimitryjl23 9:97abd5e954f1 270 file_lock.unlock();
dimitryjl23 8:24c18eecc442 271
dimitryjl23 9:97abd5e954f1 272 waver.play(wave_file);
shyamgatech 5:598d94b45bad 273
dimitryjl23 9:97abd5e954f1 274 file_lock.lock();
dimitryjl23 9:97abd5e954f1 275 fclose(wave_file);
dimitryjl23 9:97abd5e954f1 276 file_lock.unlock();
dimitryjl23 9:97abd5e954f1 277 play = false;
dimitryjl23 9:97abd5e954f1 278 myled = 0;
dimitryjl23 9:97abd5e954f1 279 speaker_lock.unlock();
dimitryjl23 9:97abd5e954f1 280 }
dimitryjl23 8:24c18eecc442 281 Thread::wait(1000);
annieluo2 0:d6c9b09b4042 282 }
dimitryjl23 9:97abd5e954f1 283
annieluo2 0:d6c9b09b4042 284 }
shyamgatech 5:598d94b45bad 285
annieluo2 0:d6c9b09b4042 286
annieluo2 0:d6c9b09b4042 287 int main()
annieluo2 0:d6c9b09b4042 288 {
dimitryjl23 8:24c18eecc442 289 //sd.mount();
dimitryjl23 8:24c18eecc442 290 pc.printf("I have updated\n");
annieluo2 0:d6c9b09b4042 291 Thread th1(speaker_thread);
annieluo2 1:5dd6801bb0d6 292 Thread th2(display_thread);
shyamgatech 5:598d94b45bad 293 char c;
annieluo2 0:d6c9b09b4042 294 while(1) {
dimitryjl23 8:24c18eecc442 295 /*myled = 1;
annieluo2 1:5dd6801bb0d6 296 wait(0.2);
annieluo2 1:5dd6801bb0d6 297 myled = 0;
annieluo2 1:5dd6801bb0d6 298 wait(0.2);
dimitryjl23 8:24c18eecc442 299 */
shyamgatech 5:598d94b45bad 300 while(!pc.readable()) {
shyamgatech 5:598d94b45bad 301 Thread::wait(1);
shyamgatech 5:598d94b45bad 302 }
shyamgatech 5:598d94b45bad 303 if (pc.getc() == '!') {
shyamgatech 5:598d94b45bad 304 c = pc.getc();
shyamgatech 5:598d94b45bad 305 switch(c) {
shyamgatech 5:598d94b45bad 306 case '1':
shyamgatech 5:598d94b45bad 307 song = "africa-toto";
dimitryjl23 8:24c18eecc442 308
shyamgatech 5:598d94b45bad 309 break;
shyamgatech 5:598d94b45bad 310 case '2':
shyamgatech 5:598d94b45bad 311 song = "around_the_world-atc";
dimitryjl23 8:24c18eecc442 312 song_data_length = NUM_ELEMENTS_AROUND_THE_WORLD;
dimitryjl23 8:24c18eecc442 313 song_data = data_around_the_world;
shyamgatech 5:598d94b45bad 314 break;
shyamgatech 5:598d94b45bad 315 case '3':
shyamgatech 5:598d94b45bad 316 song = "beautiful_life-ace_of_base";
shyamgatech 5:598d94b45bad 317 break;
shyamgatech 5:598d94b45bad 318 case '4':
shyamgatech 5:598d94b45bad 319 song = "dont_speak-no_doubt";
dimitryjl23 8:24c18eecc442 320 song_data_length = NUM_ELEMENTS_DONT_SPEAK_NO_DOUBT;
dimitryjl23 8:24c18eecc442 321 song_data = data_dont_speak_no_doubt;
shyamgatech 5:598d94b45bad 322 break;
shyamgatech 5:598d94b45bad 323 case '5':
shyamgatech 5:598d94b45bad 324 song = "my-love";
dimitryjl23 8:24c18eecc442 325 song_data_length = NUM_ELEMENTS_MY_LOVE;
dimitryjl23 8:24c18eecc442 326 song_data = data_my_love;
shyamgatech 5:598d94b45bad 327 break;
shyamgatech 5:598d94b45bad 328 case '6':
shyamgatech 5:598d94b45bad 329 song = "Song1_test";
shyamgatech 5:598d94b45bad 330 break;
shyamgatech 5:598d94b45bad 331 case 'P':
shyamgatech 5:598d94b45bad 332 // wave_player plays
shyamgatech 5:598d94b45bad 333 play = true;
dimitryjl23 9:97abd5e954f1 334 myled =1;
shyamgatech 5:598d94b45bad 335 break;
shyamgatech 5:598d94b45bad 336 case 'S':
shyamgatech 5:598d94b45bad 337 // wave_player stops
shyamgatech 5:598d94b45bad 338 play = false;
dimitryjl23 9:97abd5e954f1 339 myled = 0;
shyamgatech 5:598d94b45bad 340 break;
shyamgatech 5:598d94b45bad 341 default:
shyamgatech 5:598d94b45bad 342 break;
shyamgatech 5:598d94b45bad 343 }
shyamgatech 5:598d94b45bad 344 }
annieluo2 0:d6c9b09b4042 345 Thread::wait(100);
annieluo2 0:d6c9b09b4042 346 }
shyamgatech 5:598d94b45bad 347
annieluo2 0:d6c9b09b4042 348 }