Get value in a specific range

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
thesteira
Date:
Tue Oct 13 17:33:47 2015 +0000
Commit message:
Mapping Values to a specific Range

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r d2a831f8eece main.cpp
--- /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
diff -r 000000000000 -r d2a831f8eece mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 13 17:33:47 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file