BE@R lab / motion_control

Dependencies:   motor_relay

Dependents:   dog_V3_3_testmotor

Revision:
4:6509fec6a6fb
Parent:
3:4fa191f2194d
Child:
5:91d905f8bef7
--- a/motion_control.h	Fri Jul 17 15:35:09 2015 +0000
+++ b/motion_control.h	Sat Jul 18 05:52:56 2015 +0000
@@ -9,8 +9,8 @@
 public:
     MOTION_CONTROL(PinName dirA, PinName dirB, PinName limitUp, PinName limitDown, PinName vr );
 
-    int8_t limit_motor(uint8_t dirction);
-    int8_t position_control(uint16_t current, uint16_t target);
+    int limit_motor(uint8_t dirction);
+    int8_t position_control(uint16_t target);
     void calibration();
     
     int GetLimitUp();
@@ -22,12 +22,17 @@
     uint16_t GetMaxPosition();
     uint16_t GetMinPosition();
     
+
+    uint16_t GetAnalog();
+    uint16_t GetPosition();
     
-    
+    void stop();
 
 private:
 
-    MOTOR_RELAY *motor;
+    uint16_t Scale(uint16_t data);
+    
+    MOTOR_RELAY motor;
 
     DigitalIn _limit_up;
     DigitalIn _limit_down;
@@ -39,7 +44,7 @@
     uint16_t MAX_POSITION;
     uint16_t MIN_POSITION;
     
-    const uint16_t scale= 1000;
+    const static uint16_t scale = 64;
     
     
     float Kp;