โปรแกรมของบอร์ด Motion

Dependencies:   BEAR_Reciever Motor eeprom iSerial mbed

Fork of DogPID by Digital B14

Revision:
23:999dd41eef14
Parent:
22:449f31da2d3d
Parent:
21:1c04c4afe3b7
Child:
25:c66a0d029e1f
diff -r 449f31da2d3d -r 999dd41eef14 main.cpp
--- a/main.cpp	Tue Jan 26 18:16:11 2016 +0000
+++ b/main.cpp	Tue Jan 26 18:34:51 2016 +0000
@@ -60,6 +60,10 @@
 PID Up_PID(U_Kc, U_Ti, U_Td, 0.001);//Kp,Ki,Kd,Rate
 PID Low_PID(L_Kc, L_Ti, L_Td, 0.001);
 //*****************************************************/
+
+DigitalOut myled(LED1);
+
+
 void Read_Encoder(PinName Encoder)
 {
     ENC.format(8,0);
@@ -644,29 +648,38 @@
 
 }
 /*******************************************************/
-void Rc()
+inline void Rc()
 {
+    myled =1;
     uint8_t data_array[30];
     uint8_t id;
     uint8_t ins;
     uint8_t status;
 
+    
+
     status = com.ReceiveCommand(&id,data_array,&ins);
     if(status == ANDANTE_ERRBIT_NONE) {
         CmdCheck((int16_t)id,data_array,ins);
     }
+  
 }
 /*******************************************************/
 int main()
 {
-    printf("Before Read : %d,%d,%d and %d\r\n",Offset[0],Offset[1],Offset[2],Offset[3]);
+    
     
-    /*Recieve.attach(&Rc,0.000001);
-    Start_Up();
+    //Recieve.attach(&Rc,0.025);
+    //Start_Up();
+
     SET_UpperPID();
     SET_LowerPID();
 
     while(1) {
+          myled =0;
+          //wait_ms(10);
+        
+///////////////////////////////////////////////////// start
         //Set Set_point
         Up_PID.setSetPoint(Upper_SetPoint);
         Low_PID.setSetPoint(Lower_SetPoint);
@@ -674,7 +687,12 @@
         //Control Motor
         Move_Upper();
         Move_Lower();
-    }*/
+/////////////////////////////////////////////////////  stop =306us
+        //uint8_t aaa[1]={10};
+        //com.sendBodyWidth(0x01,aaa);
+        Rc();
+        //wait_ms(1);
+    }
 }