テスト

Dependencies:   C12832 USBHost mbed MMA7660 wave_player

Fork of app-board-Speaker by Ryohei Funakoshi

Revision:
19:8762c0a71816
Parent:
18:3a7e3401ada3
--- a/main.cpp	Tue Dec 13 09:54:54 2016 +0000
+++ b/main.cpp	Wed Dec 14 09:02:54 2016 +0000
@@ -154,224 +154,6 @@
     for_chat.reset();
 }
 
-
-void r_thread(void const *argument) 
-{
-    float r = 0;
-    while (true) 
-    {
-        r=0;
-        while(r<=1)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:r = 0.0;break;
-                case 1:r=0.07;break;
-                case 2:r=0.13;break;
-                case 3:r=0.20;break;
-                case 4:r=0.27;break;
-                case 5:r=0.34;break;
-                case 6:r=0.41;break;
-                case 7:r=0.48;break;
-                case 8:r=0.55;break;
-                case 9:r=0.62;break;
-                case 10:r=0.69;break;
-                case 11:r=0.76;break;
-                case 12:r=0.83;break;
-                case 13:r=0.90;break;
-                case 14:r=0.97;break;
-                }
-            //r = (float)(count%COUNT_MAX)/COUNT_MAX;
-            led1 = r;
-            //r += 0.01;
-            lcd.locate(0,16);
-            lcd.printf("R: %3.2f",r);
-            three_slots.release();
-            Thread::wait(100);
-
-        }
-        while(r>0)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:r = 0.0;break;
-                case 1:r=0.07;break;
-                case 2:r=0.13;break;
-                case 3:r=0.20;break;
-                case 4:r=0.27;break;
-                case 5:r=0.34;break;
-                case 6:r=0.41;break;
-                case 7:r=0.48;break;
-                case 8:r=0.55;break;
-                case 9:r=0.62;break;
-                case 10:r=0.69;break;
-                case 11:r=0.76;break;
-                case 12:r=0.83;break;
-                case 13:r=0.90;break;
-                case 14:r=0.97;break;
-                }
-            //r = (float)(count%COUNT_MAX)/COUNT_MAX;
-            led1 = r;
-            //r -= 0.01;
-            lcd.locate(0,16);
-            lcd.printf("R: %3.2f",r);
-            three_slots.release();
-            Thread::wait(100);
-
-        }
-    }
-} 
-void g_thread(void const *argument) 
-{
-    float g = 0;
-    while (true) 
-    {
-        g=0;
-        while(g<=1)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:g = 0.50;break;
-                case 1:g = 0.50;break;
-                case 2:g=0.63;break;
-                case 3:g=0.63;break;
-                case 4:g=0.77;break;
-                case 5:g=0.77;break;
-                case 6:g=0.90;break;
-                case 7:g=0.90;break;
-                case 8:g=0.47;break;
-                case 9:g=0.47;break;
-                case 10:g=0.33;break;
-                case 11:g=0.33;break;
-                case 12:g=0.20;break;
-                case 13:g=0.20;break;
-                case 14:g=0.07;break;
-                }
-            led2 = g;
-            //g += 0.01;
-            lcd.locate(40,16);
-            lcd.printf("G: %3.2f",g);
-            three_slots.release();
-            Thread::wait(200);
-        }
-        while(g>0)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:g = 0.50;break;
-                case 1:g = 0.50;break;
-                case 2:g=0.63;break;
-                case 3:g=0.63;break;
-                case 4:g=0.77;break;
-                case 5:g=0.77;break;
-                case 6:g=0.90;break;
-                case 7:g=0.90;break;
-                case 8:g=0.47;break;
-                case 9:g=0.47;break;
-                case 10:g=0.33;break;
-                case 11:g=0.33;break;
-                case 12:g=0.20;break;
-                case 13:g=0.20;break;
-                case 14:g=0.07;break;
-                }
-            led2 = g;
-            //g -= 0.01;
-            lcd.locate(40,16);
-            lcd.printf("G: %3.2f",g);
-            three_slots.release();
-            Thread::wait(200);
-        }
-    }
-} 
-void b_thread(void const *argument) 
-{
-    float b = 0;
-    while (true) 
-    {
-        b=0;
-        while(b<=1)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:b = 1.00;break;
-                case 1:b = 1.00;break;
-                case 2:b=1.00;break;
-                case 3:b=0.80;break;
-                case 4:b=0.80;break;
-                case 5:b=0.80;break;
-                case 6:b=0.60;break;
-                case 7:b=0.60;break;
-                case 8:b=0.60;break;
-                case 9:b=0.40;break;
-                case 10:b=0.40;break;
-                case 11:b=0.40;break;
-                case 12:b=0.20;break;
-                case 13:b=0.20;break;
-                case 14:b=0.20;break;
-                }
-            led3 = b;
-            //b += 0.01;
-            lcd.locate(80,16);
-            lcd.printf("B: %3.2f",b);
-            three_slots.release();
-            Thread::wait(300);
-        }
-        while(b>0)
-        {
-            three_slots.wait();
-            switch(count){
-                case 0:b = 1.00;break;
-                case 1:b = 1.00;break;
-                case 2:b=1.00;break;
-                case 3:b=0.80;break;
-                case 4:b=0.80;break;
-                case 5:b=0.80;break;
-                case 6:b=0.60;break;
-                case 7:b=0.60;break;
-                case 8:b=0.60;break;
-                case 9:b=0.40;break;
-                case 10:b=0.40;break;
-                case 11:b=0.40;break;
-                case 12:b=0.20;break;
-                case 13:b=0.20;break;
-                case 14:b=0.20;break;
-                }
-            led3 = b;
-            //b -= 0.01;
-            lcd.locate(80,16);
-            lcd.printf("B: %3.2f",b);
-            three_slots.release();
-            Thread::wait(300);
-        }
-    }
-} 
-void count_thread(void const *argument) 
-{
-    while (true) 
-    {
-        three_slots.wait();
-        lcd.locate(0,3);
-        lcd.printf("Counting : %d   ",i);
-        three_slots.release();
-        Thread::wait(100);
-    }
-} 
-
-void acc_thread(void const *argument) 
-{
-    while (true) 
-    {
-        acc.readData(r);
-        lcd.locate(0,0);
-        lcd.printf("x = %f", r[0]);
-        lcd.locate(0,10);
-        lcd.printf("y = %f", r[1]);
-        lcd.locate(0,20);
-        lcd.printf("z = %f", r[2]);
-        Thread::wait(10);
-    }
-} 
-
 void disp_thread(void const *argument) 
 {
     float volume;
@@ -382,13 +164,6 @@
         volume = volumeMeter.read();
         mswitch = musicSwitch.read();
         i_for20mm = (int)(mswitch*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);
         
         if (i_for20mm != i_for20mm_old)
         {
@@ -412,10 +187,6 @@
         }
         /////////////////////////////
         
-        //for debug
-        //lcd.locate(0,0);
-        //lcd.printf("volume = %f", volume);
-        //wait(mpmeter);
         Thread::wait(50);
     }
 } 
@@ -423,18 +194,8 @@
  {
     waver.play(wave_file);
     fclose(wave_file);   
-    //wave_finished = true;
 }    
-//void lcd_thread(void const *argument) 
-//{
-//        stdio_mutex.lock();
-//        lcd.locate(0,0);
-//        lcd.printf("scale = %d", scale);
-//        //lcd.cls();
-//        stdio_mutex.unlock();
-//        Thread::wait(50);
-//    
-//}
+
 int main() 
 {
     wait(0.01);
@@ -445,15 +206,8 @@
     push.fall(&Off);
     right.rise(&scaleUp);
     left.rise(&scaleDown);
-    
-    
-    //Thread thread1(r_thread,(void *)"Th 1");
-    //Thread thread2(g_thread,(void *)"Th 2");
-    //Thread thread3(b_thread,(void *)"Th 3");
-    //Thread thread4(count_thread,(void *)"Th 4");    
+       
     Thread thread6(disp_thread);
-    //Thread thread4(lcd_thread);
-    //Thread thread7(sound_thread, (void *)"Th 7");
     
     //for USB
     USBHostMSD msd("usb");
@@ -463,8 +217,6 @@
     }
     
     //for music file
-    //FILE *wave_file;
-    //sp1.period(1.0 / 16000.0);
     stdio_mutex.lock();
     wave_file = fopen("/usb/music/BGMforMBED2.wav", "r");
 
@@ -480,7 +232,6 @@
     while(1)
     {
         
-
     }
 }
  
\ No newline at end of file