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

Dependencies:   mbed

Fork of analoghalls6 by N K

Revision:
1:1f58bdcf2956
Child:
10:b4abecccec7a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/throttle.cpp	Sun Mar 01 10:51:28 2015 +0000
@@ -0,0 +1,13 @@
+#include "includes.h"
+#include "sensors.h"
+
+Throttle::Throttle(PinName pin, float min, float max) {
+    _in = new AnalogVoltageSensor(pin, 1.0f);
+    _min = min;
+    _max = max;
+}
+
+float Throttle::GetThrottle() {
+    float v = _in->GetVoltage();
+    return (v - _min) / (_max - _min);
+}
\ No newline at end of file