test

Dependencies:   MX28 iSerial mbed

Fork of MX_control by FIBO

Revision:
1:0a652990dab1
Parent:
0:c98ac0a05620
Child:
2:7f9d2f135591
--- a/classproject.cpp	Thu Oct 23 07:34:07 2014 +0000
+++ b/classproject.cpp	Fri Oct 24 08:57:50 2014 +0000
@@ -1,20 +1,52 @@
 #include "mbed.h"
 #include "MX28.h"
 
+//config param
+//-motor robotis
 #define ID_ROLL 1
 #define ID_PITCH 2
+#define BANDRATE_MOTOR 1000000
 
-#define CENTER_ROLL 2048
-#define CENTER_
+
+//param calibration
+#define CENTER_ROLL     512
+#define CENTER_PITCH    512
+
+
 
 Serial pc(USBTX, USBRX);
-MX28 mx28(PA_11, PA_12, 1000000);
+MX28 mx28(PA_11, PA_12, BANDRATE_MOTOR);
+
+DigitalIn mybutton(USER_BUTTON);
+
+//function prototype
+void setup_mode();
+void run_mode();
+
 
 int main()
 {
     pc.baud(115200);         
     pc.printf("======================================================\r\n"); 
-    
+    if(mybutton == 0)
+    {//Setup mode
+        pc.printf("Setup Mode\r\n");    
+        setup_mode();        
+    }
+    else
+    {//Run mode
+        pc.printf("Run Mode\r\n");
+        run_mode();
+    }
+    return 0;    
+}
+
+void setup_mode()
+{
     
-    return 0;    
+}
+
+void run_mode()
+{
+    
 }
\ No newline at end of file