bamlor nuttymaisuay

Dependencies:   mbed

Revision:
2:af822f5a5120
Parent:
1:c102abc55118
Child:
3:46cc9d386ff4
--- a/main.cpp	Sun Dec 10 07:31:34 2017 +0000
+++ b/main.cpp	Sun Dec 10 10:44:17 2017 +0000
@@ -46,12 +46,11 @@
 
  
    
-
-        
+BusOut B(PA_0,PA_1,PA_4,PB_0,PC_1,PC_2,PC_3), A(PC_10,PC_12,PA_13,PA_14,PC_13,PC_11,PD_2), C(PA_5,PA_6,PA_7,PC_7,PB_2,PB_1,PB_15); 
+float posA,posB,posC;
 int main()
 {
   pc.baud(9600);  
-
   //Set up I2C
   i2c.frequency(400000);  // use fast (400 kHz) I2C  
   
@@ -164,15 +163,72 @@
 
     // Serial print and/or display at 0.5 s rate independent of data rates
     delt_t = t.read_ms() - count;
-    if (delt_t > 500) { // update LCD once per half-second independent of read rate
-
+    if (delt_t > 5) { // update LCD once per half-second independent of read rate
+        pc.printf("delt_t = %f\n",delt_t);
+        posA += (gz*delt_t/1000);
+        posB = posA + 120;
+        posC = posA + 240;
+        
+//        if (posA >= 90)
+  //      
+//            A = 0x7F;
+//            B = 0x7F;
+//            C = 0x7F;
+//        }
+//        else
+//        {
+//            A = 0;
+//            B = 0;
+//            C = 0;
+//        }
+//        if (posA >= 360)
+//        {
+//            break;
+//        }
+        //if (posA >= 360)
+//        {
+//            posA-=360;
+//        }
+//        if (posA > 0 && posA < 30)
+//        {
+//            A = 0x7F;
+//        }
+//        else
+//        {
+//            A = 0x00;
+//        }
+//        if (posB >= 360)
+//        {
+//            posB-=360;
+//        }
+//        if (posB > 0 && posB < 30)
+//        {
+//            B = 0x7F;
+//        }
+//        else
+//        {
+//            B = 0x00;
+//        }
+//        if (posC >= 360)
+//        {
+//            posC-=360;
+//        }
+//        if (posC > 0 && posC < 30)
+//        {
+//            C = 0x7F;
+//        }
+//        else
+//        {
+//            C = 0x00;
+//        }
 //    pc.printf("ax = %f", 1000*ax); 
 //    pc.printf(" ay = %f", 1000*ay); 
 //    pc.printf(" az = %f  mg\n\r", 1000*az); 
 
-    pc.printf("gx = %f", gx); 
-    pc.printf(" gy = %f", gy); 
+//    pc.printf("gx = %f", gx); 
+//    pc.printf(" gy = %f", gy); 
     pc.printf(" gz = %f  deg/s\n\r", gz); 
+    pc.printf(" posA = %f\n", posA);
     
  //   pc.printf("gx = %f", mx); 
 //    pc.printf(" gy = %f", my); 
@@ -224,5 +280,8 @@
     sumCount = 0; 
 }
 }
- 
+A = 0;
+B = 0;
+C = 0;
+ pc.printf("fuck you");
  }
\ No newline at end of file