Like Arduinos "map" function reScale converts values from different sizes.
Dependents: jrh52_a3 TBI_FIAT_FEEDFORWARD Ignition accuBlast_display ... more
Usage
#include "mbed.h" #include "reScale.h" reScale _scale(0,100,0,10); int main() { uint8_t value=_scale.from(50); // value is now set to 5 }
Diff: reScale.h
- Revision:
- 0:04d95412bcd3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/reScale.h Mon Mar 03 19:43:51 2014 +0000 @@ -0,0 +1,10 @@ +#include "mbed.h" + +class reScale { +public: +reScale(long in_min, long in_max, long out_min, long out_max); + +long from(long value); +protected: +long _inMin ,_inMax ,_outMin ,_outMax ; +}; \ No newline at end of file