Allow to set the resolution to either microseconds or microseconds
This commit is contained in:
@ -13,6 +13,8 @@ class PID
|
||||
#define MANUAL 0
|
||||
#define DIRECT 0
|
||||
#define REVERSE 1
|
||||
#define MILLIS 0
|
||||
#define MICROS 1
|
||||
|
||||
//commonly used functions **************************************************************************
|
||||
PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
|
||||
@ -41,6 +43,9 @@ class PID
|
||||
// once it is set in the constructor.
|
||||
void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which
|
||||
// the PID calculation is performed. default is 100
|
||||
void setResolution(int); // * Set the resolution of the getTime() function.
|
||||
// MILLIS sets the resolution to milliseconds.
|
||||
// MICROS sets the resolution to microseconds.
|
||||
|
||||
|
||||
|
||||
@ -53,6 +58,8 @@ class PID
|
||||
|
||||
private:
|
||||
void Initialize();
|
||||
unsigned long getTime(); // * This will call either millis() or micros()
|
||||
// depending on the used resolution.
|
||||
|
||||
double dispKp; // * we'll hold on to the tuning parameters in user-entered
|
||||
double dispKi; // format for display purposes
|
||||
@ -73,6 +80,7 @@ class PID
|
||||
double ITerm, lastInput;
|
||||
|
||||
unsigned long SampleTime;
|
||||
double secondsDivider;
|
||||
double outMin, outMax;
|
||||
bool inAuto;
|
||||
};
|
||||
|
Reference in New Issue
Block a user