Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Motor by
Diff: Motor.h
- Revision:
- 0:1252cd3b995f
- Child:
- 1:4ab6e9768847
diff -r 000000000000 -r 1252cd3b995f Motor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.h	Fri Jun 19 06:35:46 2015 +0000
@@ -0,0 +1,38 @@
+
+#ifndef PID_H
+#define PID_H
+
+#include "mbed.h"
+#define Front 1
+#define Back 2
+#define Stop 3
+#define Free 4
+class Motor {
+
+public:
+
+    Motor(PinName _pin_h1, PinName _pin_g2, PinName _pin_g1, PinName _pin_h2,PinName _pwm,float Max);
+    Motor& operator= (float duty)
+    {
+        if(duty<0)
+        {
+            duty*=-1;
+            run(Front,duty);
+        }
+        else if(duty>0)
+        {
+            run(Back,duty);
+        }
+        else run(Free,duty);
+        return *this;
+    }
+    void run(int i,float duty);
+    float min,max;
+private:
+    
+    float Duty;
+    BusOut motor;
+    PwmOut PwmPin;
+};
+
+#endif /* PID_H */
    