working-est copy with class-based code. still open loop

Dependencies:   mbed

Fork of analoghalls6 by N K

Revision:
10:b4abecccec7a
Parent:
1:1f58bdcf2956
--- a/throttle.cpp	Fri Mar 06 19:12:53 2015 +0000
+++ b/throttle.cpp	Sun Mar 08 00:45:28 2015 +0000
@@ -9,5 +9,8 @@
 
 float Throttle::GetThrottle() {
     float v = _in->GetVoltage();
-    return (v - _min) / (_max - _min);
+    v = (v - _min) / (_max - _min);
+    if (v > 1.0f) return 1.0f;
+    if (v < 0.0f) return 0.0f;
+    return v;
 }
\ No newline at end of file