first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
motor_drive.h@0:aefa71eaf32a, 2017-09-24 (annotated)
- Committer:
- echo_piyo
- Date:
- Sun Sep 24 05:24:19 2017 +0000
- Revision:
- 0:aefa71eaf32a
????2??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:aefa71eaf32a | 1 | /* |
echo_piyo | 0:aefa71eaf32a | 2 | MotorDrive Name(cw_ccw, pwm); |
echo_piyo | 0:aefa71eaf32a | 3 | |
echo_piyo | 0:aefa71eaf32a | 4 | setup(float frequency, float acceleration, float timerCycle); |
echo_piyo | 0:aefa71eaf32a | 5 | MotorDrive関数のセットアップ |
echo_piyo | 0:aefa71eaf32a | 6 | frequency : pwmの周波数[Hz] |
echo_piyo | 0:aefa71eaf32a | 7 | acceleration : 加速度[m/s^2] |
echo_piyo | 0:aefa71eaf32a | 8 | timerCycle : outputを呼び出す周期[s] |
echo_piyo | 0:aefa71eaf32a | 9 | |
echo_piyo | 0:aefa71eaf32a | 10 | output(duty) |
echo_piyo | 0:aefa71eaf32a | 11 | dutyになるように出力する |
echo_piyo | 0:aefa71eaf32a | 12 | */ |
echo_piyo | 0:aefa71eaf32a | 13 | |
echo_piyo | 0:aefa71eaf32a | 14 | #ifndef MBED_MOTOR_DRIVE_H |
echo_piyo | 0:aefa71eaf32a | 15 | #define MBED_MOTOR_DRIVE_H |
echo_piyo | 0:aefa71eaf32a | 16 | |
echo_piyo | 0:aefa71eaf32a | 17 | #include "mbed.h" |
echo_piyo | 0:aefa71eaf32a | 18 | |
echo_piyo | 0:aefa71eaf32a | 19 | #define DUTY_LIMIT 0.95 |
echo_piyo | 0:aefa71eaf32a | 20 | |
echo_piyo | 0:aefa71eaf32a | 21 | class MotorDrive |
echo_piyo | 0:aefa71eaf32a | 22 | { |
echo_piyo | 0:aefa71eaf32a | 23 | public : |
echo_piyo | 0:aefa71eaf32a | 24 | MotorDrive (PinName Direction,PinName Pwm); |
echo_piyo | 0:aefa71eaf32a | 25 | |
echo_piyo | 0:aefa71eaf32a | 26 | void setup(float frequency, float acceleration, float timerCycle); |
echo_piyo | 0:aefa71eaf32a | 27 | |
echo_piyo | 0:aefa71eaf32a | 28 | void output(float targetDuty); |
echo_piyo | 0:aefa71eaf32a | 29 | |
echo_piyo | 0:aefa71eaf32a | 30 | private : |
echo_piyo | 0:aefa71eaf32a | 31 | DigitalOut direction; |
echo_piyo | 0:aefa71eaf32a | 32 | PwmOut pwm; |
echo_piyo | 0:aefa71eaf32a | 33 | float a; |
echo_piyo | 0:aefa71eaf32a | 34 | float duty; |
echo_piyo | 0:aefa71eaf32a | 35 | }; |
echo_piyo | 0:aefa71eaf32a | 36 | |
echo_piyo | 0:aefa71eaf32a | 37 | #endif |