seisakutyu

Dependencies:   mbed MCP23017

Revision:
0:db8d4af513c0
Child:
1:5b0303768126
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor/Motor.h	Mon Jan 20 08:46:24 2020 +0000
@@ -0,0 +1,40 @@
+#ifndef  MOTOR_H_
+#define  MOTOR_H_
+
+#include "mbed.h"
+
+typedef enum dire {
+    FREE  = 0,
+    FOR   = 1,
+    BACK  = 2,
+    BRAKE = 3,
+}dire;
+
+class MOTOR {
+    public:
+        // 
+        MOTOR(PinName D1, PinName D2, PinName pwm);
+        /* direction
+            FREE
+            FOR
+            BACK
+            BRAKE
+        */
+        /* pwm
+            pwm is 0 ~ 100(%)
+        */
+        // durection and pwm set
+        void Dir(dire mode, uint8_t pwm);
+        // direction set
+        void Dir(dire mode);
+        // pwm set
+        void PWM(uint8_t pwm);
+        
+    private:
+        DigitalOut D1_;
+        DigitalOut D2_;
+        PwmOut     pwm_;
+};
+
+#endif //MOTOR_H_
+