テスト

Dependencies:   C12832 USBHost mbed MMA7660 wave_player

Fork of app-board-Speaker by Ryohei Funakoshi

Revision:
14:3b123bcdd79c
Parent:
13:58877e942d84
Child:
15:46ca600425fc
--- a/main.cpp	Mon Dec 12 09:33:03 2016 +0000
+++ b/main.cpp	Mon Dec 12 12:10:51 2016 +0000
@@ -43,6 +43,8 @@
 int count = 0;
 
 float mm[]={mC,mD,mE,mF,mG,mA,mB,mC*2,mD*2,mE*2,mF*2,mG*2,mA*2,mB*2,mC*4};
+
+float mmm[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//has 21
 void intRise(void) 
 {    
     if(for_chat.read_ms()>THRESH);
@@ -292,12 +294,24 @@
 void disp_thread(void const *argument) 
 {
     float mpmeter;
+    int i_for20mm;
     while (true) 
     {
         mpmeter = mypotentiometer.read();
+        i_for20mm = (int)(mpmeter*20);//change 20 param
         //wait(mpmeter);
         //lcd.locate(0,10);
         //lcd.printf("mpmeter = %f", mpmeter);
+        
+        // for debug
+        //lcd.locate(0,10);
+        //lcd.printf("i = %d  ", i_for20mm);
+        
+        // example sound (odd sound)
+        mmm[i_for20mm] = mpmeter*100; // mmm[0-20] <- any param
+        sp1.period(1.0/(mmm[i_for20mm]));
+        sp1.write(0.5f);
+        /////////////////////////////
         //wait(mpmeter);
         Thread::wait(2);
     }