Six crescent shaped legs

Dependencies:   mbed

Revision:
3:2235787e78c4
Parent:
2:cf0147952fb9
Child:
4:4d54794b99a5
diff -r cf0147952fb9 -r 2235787e78c4 main.cpp
--- a/main.cpp	Tue Mar 29 12:03:14 2016 +0000
+++ b/main.cpp	Tue Mar 29 12:54:12 2016 +0000
@@ -1,32 +1,36 @@
 #include "mbed.h"
-#include "Motor.hpp"
-#include "Encoder.hpp"
+#include "EncoderMotor.hpp"
+#include "PIDController.hpp"
 
 InterruptIn bt(USER_BUTTON);
 Serial pc(USBTX, USBRX);
 
-Motor m(PB_0, PC_0, PC_1);
 Encoder e(PA_0, PA_1);
+PIDController ec(0.01f);
+EncoderMotor m(PB_0, PC_0, PC_1, e, ec);
 
 void rise()
 {
     pc.printf("rise\n");
-    m.drive(0.1f);
+    m.drive(0);
 }
 
 void fall()
 {
     pc.printf("fall\n");
-    m.drive(-0.1f);
+    m.drive(-380);
 }
 
 int main()
-{
-    bt.rise(rise);
-    bt.fall(fall);
+{   
+    bt.rise(&rise);
+    bt.fall(&fall);
+    
+    m.setup();
+    
     while(1)
     {
-        pc.printf("%d\n", e.getCount());
-        wait(0.5);
+        pc.printf("%d %d %f\n", e.getCount(), m.getSpeed(), m.out);
+        wait(0.1);
     }
 }
\ No newline at end of file