sfbsg
Dependencies: mbed
Diff: LinearCharacteristics.cpp
- Revision:
- 0:8ab621116ccd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LinearCharacteristics.cpp Tue Apr 03 15:17:11 2018 +0000 @@ -0,0 +1,29 @@ +#include "LinearCharacteristics.h" + +using namespace std; + +LinearCharacteristics::LinearCharacteristics(float k, float offset, float min, float max) // standard lin characteristics +{ + this -> k = k; + this -> offset = offset; + this -> min = min; + this -> max = max; +// ... +} + +LinearCharacteristics::~LinearCharacteristics(){} + +float LinearCharacteristics::trans(float input) +{ + + output = k*input + offset; + + if(output >= max) { + output = max; + } + if(output <= min) { + output = min; + } + return output; +} +