Adds pointer acceleration to combat missed steps and losing track of position

Dependents:   Auto

Fork of Stepper_Motor_X27168 by Stepper Motor

Revision:
1:e7c0920184e4
Parent:
0:c346170974bc
--- a/StepperMotor_X27168.h	Tue Oct 20 00:36:06 2015 +0000
+++ b/StepperMotor_X27168.h	Mon May 02 15:03:35 2016 +0000
@@ -85,6 +85,7 @@
      *
      *  @param s steps per second : lower number makes the turn slower (default = 1000)
      */
+    void set_max_speed(float s);
     void set_speed(float s);
     
     /** Get the motor speed (i.e. number of steps per second)
@@ -121,16 +122,20 @@
      */      
     void step_position(int pos);
     
+    int get_position();
+    
     /** Turn the motor to a specific degree angle with a resolution of 0.5 degrees
      *
      *  @param angle desired angle (0-(max_positon/2))
      */
     void angle_position(float angle);
     
+    void set_position_dynamic(float pos);
 private:
     BusOut motor_control;       // 4-bit Bus Controlling the H-Brigde
     int max_position;           // Software Limit to motor rotation
     int speed;                  // Speed of Rotation
+    int max_speed;
     int cur_position;           // Current Position of Motor (0-max_position)
     Polarity cur_state;         // Current State of H-Brige Controls
 };