Get value in a specific range
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:d2a831f8eece
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 13 17:33:47 2015 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +DigitalOut myled(LED1); + + + +int main() +{ + while(1) + {} +} + + +//Map Input Signal-level to Output-Level +// value = input value +//from_start = start value which should be mapped +//from_end = end value which should be mapped +//to_start = mapped start value +//to_end = mapped end value +// © Steirer Daniel :) + +float ValueMapping(float value, float to_start, float to_end, float from_start, float from_end) +{ + return((value-from_start)/(from_end-from_start))*(to_end-to_start)+to_start; + +} \ No newline at end of file