hahaha

Dependencies:   mbed

Revision:
1:d8ce226c8c2e
Parent:
0:a291977ec0b1
Child:
2:ce3ee4bc8cf7
--- a/main.cpp	Mon Dec 05 18:31:43 2016 +0000
+++ b/main.cpp	Tue Dec 06 06:11:54 2016 +0000
@@ -5,7 +5,7 @@
 InterruptIn lim(D3);
 InterruptIn rotate(D4);
 InterruptIn choose(D5);
-Ticker flipper;
+//Ticker flipper;
 Ticker Update;
 
 bmuimu imu;
@@ -117,7 +117,7 @@
 
 void UUpdate()
 {
-    imu.update();   
+    imu.bmuupdate();   
 }
 
 void Sent(char arrayi[],float it,int siz)
@@ -646,42 +646,33 @@
             }
             
             
-void LInitial(){  //ลงค่าเสร็จ
-    if (timer.read() > 1) {
-        
-        
-        duino.putc(lis[20]);
-        
-        
-        timer.reset();
-                }
-    if (duino.readable()){
-            }         
-}
 
 
 int main() // main program of 
 {
-    lim.rise(&Rise1);
+    /*lim.rise(&Rise1);
     lim.fall(&Fall1);
     rotate.rise(&Rise2);
     rotate.fall(&Fall2);
     choose.rise(&Rise3);
-    choose.fall(&Fall3);
-    
-    LInitial(); // set initial pattern in led matrix.
-    wait(5); // wait 5 second for putting the box down to set initial position of imu.
+    choose.fall(&Fall3);*/
+    /*for(int i=0;i<200;i++)
+    {
+        UUpdate();
+    }*/
+    //LInitial(); // set initial pattern in led matrix.
+    //wait(5); // wait 5 second for putting the box down to set initial position of imu.
     //imu.Initial(); // set initial for imu.
-    Update.attach(&UUpdate,1.0); //timer interrupt for recieving bluetooth. 
-    while((dete[0]!='i')||(dete[1]!='n')||(dete[2]!='i')||(dete[3]!='t'))
-    {
-    }
+    //Update.attach(&UUpdate,0.1); //timer interrupt for recieving bluetooth. 
+    //while((dete[0]!='i')||(dete[1]!='n')||(dete[2]!='i')||(dete[3]!='t'))
+    //{
+    //}
     LWbox(); // set led to tell the player that the game is ready and this is the woman-box.
     t.start();
     while (1) // void loop.
     {
         state = 1;
-        
+        UUpdate();
         if (buttonState[0] == 1) // if the boxes are connected.
         {
             x = GetCoordinateX();
@@ -713,7 +704,7 @@
                 LError();
                 while(buttonState[0] == 1)
                 {
-                       
+                   UUpdate();    
                 }
             }else
             {
@@ -732,6 +723,7 @@
                     LMapComplete(); // show that this position is ok.
                     while(1)
                     {
+                        UUpdate();
                         anach = chooseAnother() ;// wheather thr others box is choosen. 
                         if ((buttonState[2]==1) && (!anach)) 
                         {
@@ -749,7 +741,7 @@
                                 state = 3;
                                 while((buttonState[1]==0)&&(anotherRotate()))
                                 {
-                                    
+                                    UUpdate();
                                 }
                                 
                                 yyaaww = imu.Rotate(); // check wheater rotating is error.