190711
Diff: motor.h
- Revision:
- 4:a629f46d6594
- Parent:
- 1:911f5a86c105
- Child:
- 5:15d0276d7e21
--- a/motor.h Thu May 23 08:53:19 2019 +0000 +++ b/motor.h Thu May 23 23:02:14 2019 +0000 @@ -27,12 +27,13 @@ void setTarget(int spd); void setPID(float p, float i, float d); void setDirection(); // set the direction - + //Control Methods void UpdateCurrentPosition(); void PIDControl(); void Reset(void); + private: PwmOut _pwm; @@ -42,7 +43,7 @@ Ticker _tick; long CurrentPosition, PreviousPosition; // Position Value - int TargetSpeed, CurrentSpeed, Error,PreviousError; // Speed Data + int CurrentSpeed, Error,PreviousError; // Speed Data unsigned int duty; // Duty level ( 0-1024) unsigned int pwmPeriod; // default 50ms unsigned char pwmpin; // PB2 ( 10 ) @@ -55,6 +56,7 @@ unsigned char cpidx; float CalculateRPM(int DeltaCnt); // Calculate RPM value float vel; + int TargetSpeed; }; #endif