PRAWIRA

Revision:
0:86d90c65f83b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.cpp	Mon Sep 16 10:06:48 2019 +0000
@@ -0,0 +1,17 @@
+#include "Motor.h"
+
+Motor::Motor(PinName dright, PinName dleft, PinName pwmpin): dright_(dright), dleft_(dleft), pwmpin_(pwmpin) {
+    pwmpin_.period_us(50);  
+}
+
+void Motor::setpwm(float inputpwm) {
+    if (inputpwm >= 0) {
+        dright_ = 1;
+        dleft_ = 0;
+        pwmpin_.write(inputpwm);
+    } else {
+        dright_ = 0;
+        dleft_ = 1;
+        pwmpin_.write(-1 * inputpwm);
+    }  
+}
\ No newline at end of file