v

Revision:
0:13fa5527033b
Child:
1:377ad5dc13e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messen.cpp	Thu Feb 18 14:59:02 2016 +0000
@@ -0,0 +1,33 @@
+#include "pins.h"
+#include "mbed.h"
+AnalogIn throttle(SPEED_PIN);
+DigitalIn breake(BREAKE_PIN);
+AnalogIn voltage(VOLTAGE_PIN);
+AnalogIn current(CURRENT_PIN);
+
+float getSpeed(){
+  float speed = throttle.read() -0.27;
+  if(speed < 0){          // meas0 isnt allowed to be <0 because its sets the pulsewidht of the pwm
+    speed = 0;
+  }
+  speed *= 2;  // creates values between 0 and 1
+  if(speed > 1){      // meas0 isnt allowed to be >1 because its sets the pulsewidth of the pwm 
+    speed = 1;
+  }
+  return speed;
+}
+
+int getBreake(){
+  int breake_value = breake.read();
+  return breake_value;
+}
+
+float getVoltage(){
+  float voltage_value = voltage.read();
+  return voltage_value;
+}
+
+float getCurrent(){
+  float current_value = current.read();
+  return current_value;
+}
\ No newline at end of file