BA / Mbed 2 deprecated RT2_P3_DAC_test

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LinearCharacteristics.cpp Source File

LinearCharacteristics.cpp

00001 #include "LinearCharacteristics.h"
00002 
00003 using namespace std;
00004 
00005 LinearCharacteristics::LinearCharacteristics(float k, float offset, float min, float max)     // standard lin characteristics
00006 {
00007     this -> k = k;
00008     this -> offset = offset;
00009     this -> min = min;
00010     this -> max = max;
00011 // ...
00012 }
00013 
00014 LinearCharacteristics::~LinearCharacteristics(){}
00015 
00016 float LinearCharacteristics::trans(float input)
00017 {
00018 
00019     output = k*input + offset;
00020 
00021     if(output >= max) {
00022         output = max;
00023     }
00024     if(output <= min) {
00025         output = min;
00026     }
00027     return output;
00028 }
00029