Generates reference based on analog input

Dependents:   locomotion_pid_action_refactor_EMG

Revision:
0:5c67195a412d
Child:
2:35c05e7698f5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/refGen.cpp	Mon Oct 16 08:44:22 2017 +0000
@@ -0,0 +1,20 @@
+#include "refGen.h"
+#include "mbed.h"
+
+// Member function definitions
+refGen::refGen(PinName a):refPin(a){
+
+    }
+
+float refGen :: getReferencePosition(float maxAngle, bool r_direction){
+    float r;
+    if(r_direction == false){
+        // Clockwise rotation yields positive reference
+        r = maxAngle*refPin.read();
+        }
+    if(r_direction == true){
+        // Counterclockwise rotation yields negative reference
+        r = -1*maxAngle*refPin.read();
+        }
+    return r;
+    }
\ No newline at end of file