mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.2 PID_RT
This commit is contained in:
parent
e83ffeb82e
commit
d4372b1341
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: PID_RT.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.1
|
||||
// VERSION: 0.1.2
|
||||
// PURPOSE: PID library for Arduino
|
||||
// URL: https://github.com/RobTillaart/PID
|
||||
//
|
||||
@ -9,6 +9,7 @@
|
||||
|
||||
#include "PID_RT.h"
|
||||
|
||||
|
||||
PID_RT::PID_RT()
|
||||
{
|
||||
reset();
|
||||
@ -140,4 +141,5 @@ bool PID_RT::setInterval(uint32_t interval)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
@ -2,12 +2,14 @@
|
||||
//
|
||||
// FILE: PID_RT.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.1
|
||||
// VERSION: 0.1.2
|
||||
// PURPOSE: PID library for Arduino
|
||||
// URL: https://github.com/RobTillaart/PID_RT
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
class PID_RT
|
||||
{
|
||||
public:
|
||||
@ -87,4 +89,5 @@ private:
|
||||
bool _POI = true; // Proportional On Input - Error
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
@ -7,10 +7,12 @@
|
||||
|
||||
Arduino library for PID controller
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
The PID_RT class allows the user to instantiate a PID controller.
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
### Constructor
|
||||
@ -18,6 +20,7 @@ The PID_RT class allows the user to instantiate a PID controller.
|
||||
- **PID_RT()** minimal constructor.
|
||||
- **PID_RT(float sp, float Kp, float Ki, float Kd)** constructor that sets minimal parameters to get started.
|
||||
|
||||
|
||||
### Core
|
||||
|
||||
- **void reset()** resets internals to startup.
|
||||
@ -27,12 +30,14 @@ The PID_RT class allows the user to instantiate a PID controller.
|
||||
- **float getOutput()** get the last calculated output value.
|
||||
- **bool setK(float Kp, float Ki, float Kd)** Set the initial P I D parameters as a group.
|
||||
|
||||
|
||||
### Start Stop
|
||||
|
||||
- **void start()** // enable the PID controller to compute new output values.
|
||||
- **void stop()** disable the PID controller **compute()**.
|
||||
- **bool isRunning()**
|
||||
|
||||
|
||||
### Additional parameters
|
||||
|
||||
- **bool setInterval(uint32_t interval)** set the interval between 2 **compute()** calls. Returns **true** if changed, otherwise **false**.
|
||||
@ -53,6 +58,7 @@ The PID_RT class allows the user to instantiate a PID controller.
|
||||
- **bool isPropOnInput()** read back setting.
|
||||
- **bool isPropOnError()** read back setting.
|
||||
|
||||
|
||||
### debugging calls
|
||||
|
||||
Might be obsolete in future.
|
||||
@ -61,6 +67,7 @@ Might be obsolete in future.
|
||||
- **float getLastError()** read the last error.
|
||||
- **uint32_t getLastTime()** read the last.
|
||||
|
||||
|
||||
## Operations
|
||||
|
||||
See examples.
|
||||
|
@ -11,6 +11,7 @@
|
||||
// connect a potmeter to A0
|
||||
// play :)
|
||||
|
||||
|
||||
#include "PID_RT.h"
|
||||
|
||||
PID_RT PID;
|
||||
@ -20,6 +21,7 @@ const int PWM_PIN = 3; // UNO PWM pin
|
||||
int op = 0;;
|
||||
float input = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -34,6 +36,7 @@ void setup()
|
||||
op = analogRead(A0);
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
input = analogRead(A0);
|
||||
@ -48,4 +51,5 @@ void loop()
|
||||
}
|
||||
}
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
// -- END OF FILE --
|
||||
|
@ -3,22 +3,27 @@
|
||||
# Datatypes (KEYWORD1)
|
||||
PID_RT KEYWORD1
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
reset KEYWORD2
|
||||
setPoint KEYWORD2
|
||||
getSetPoint KEYWORD2
|
||||
compute KEYWORD2
|
||||
getOutput KEYWORD2
|
||||
|
||||
start KEYWORD2
|
||||
stop KEYWORD2
|
||||
isRunning KEYWORD2
|
||||
|
||||
setReverse KEYWORD2
|
||||
getReverse KEYWORD2
|
||||
setInterval KEYWORD2
|
||||
getInterval KEYWORD2
|
||||
|
||||
setOutputRange KEYWORD2
|
||||
getOutputMin KEYWORD2
|
||||
getOutputMax KEYWORD2
|
||||
|
||||
setK KEYWORD2
|
||||
setKp KEYWORD2
|
||||
setKi KEYWORD2
|
||||
@ -26,10 +31,12 @@ setKd KEYWORD2
|
||||
getKp KEYWORD2
|
||||
getKi KEYWORD2
|
||||
getKd KEYWORD2
|
||||
|
||||
setPropOnInput KEYWORD2
|
||||
setPropOnError KEYWORD2
|
||||
isPropOnInput KEYWORD2
|
||||
isPropOnError KEYWORD2
|
||||
|
||||
getInput KEYWORD2
|
||||
getLastError KEYWORD2
|
||||
getLastTime KEYWORD2
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/PID_RT"
|
||||
},
|
||||
"version":"0.1.1",
|
||||
"version": "0.1.2",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*"
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=PID_RT
|
||||
version=0.1.1
|
||||
version=0.1.2
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino PID library
|
||||
|
@ -28,6 +28,7 @@ unittest_setup()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
unittest_teardown()
|
||||
{
|
||||
}
|
||||
@ -97,6 +98,8 @@ unittest(test_compute)
|
||||
assertEqual(1, 1);
|
||||
}
|
||||
|
||||
|
||||
unittest_main()
|
||||
|
||||
|
||||
// --------
|
||||
|
Loading…
Reference in New Issue
Block a user