first

Dependents:   17robo_fuzi 17robo_tokyo_kaede

Revision:
0:aefa71eaf32a
diff -r 000000000000 -r aefa71eaf32a motor_drive.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motor_drive.h	Sun Sep 24 05:24:19 2017 +0000
@@ -0,0 +1,37 @@
+/*
+MotorDrive Name(cw_ccw, pwm);
+
+setup(float frequency, float acceleration, float timerCycle);
+MotorDrive関数のセットアップ
+frequency    : pwmの周波数[Hz]
+acceleration : 加速度[m/s^2]
+timerCycle   : outputを呼び出す周期[s]
+
+output(duty)
+dutyになるように出力する
+*/
+
+#ifndef MBED_MOTOR_DRIVE_H
+#define MBED_MOTOR_DRIVE_H
+
+#include "mbed.h"
+
+#define DUTY_LIMIT   0.95
+
+class MotorDrive
+{
+public  :
+    MotorDrive (PinName Direction,PinName Pwm);
+
+    void setup(float frequency, float acceleration, float timerCycle);
+
+    void output(float targetDuty);
+
+private :
+    DigitalOut direction;
+    PwmOut pwm;
+    float a;
+    float duty;
+};
+
+#endif
\ No newline at end of file