motordrive
Dependents: MotorIdentification MotorPIcontrol Motor_P_PositionControl
motordriver.h@0:876ba416c547, 2019-03-18 (annotated)
- Committer:
- porizou3
- Date:
- Mon Mar 18 04:46:47 2019 +0000
- Revision:
- 0:876ba416c547
commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
porizou3 | 0:876ba416c547 | 1 | #ifndef __motordriver_h |
porizou3 | 0:876ba416c547 | 2 | #define __motordriver_h |
porizou3 | 0:876ba416c547 | 3 | |
porizou3 | 0:876ba416c547 | 4 | /** |
porizou3 | 0:876ba416c547 | 5 | * Includes |
porizou3 | 0:876ba416c547 | 6 | */ |
porizou3 | 0:876ba416c547 | 7 | #include "mbed.h" |
porizou3 | 0:876ba416c547 | 8 | |
porizou3 | 0:876ba416c547 | 9 | class Motor { |
porizou3 | 0:876ba416c547 | 10 | |
porizou3 | 0:876ba416c547 | 11 | public: |
porizou3 | 0:876ba416c547 | 12 | /* |
porizou3 | 0:876ba416c547 | 13 | * pwm --- PwmOut pin |
porizou3 | 0:876ba416c547 | 14 | * fwd --- DigitalOut pin モーター正転 |
porizou3 | 0:876ba416c547 | 15 | * rev --- DigitalOut pin モーター逆転 |
porizou3 | 0:876ba416c547 | 16 | */ |
porizou3 | 0:876ba416c547 | 17 | Motor(PinName pwm , PinName fwd , PinName rev , float frequency); |
porizou3 | 0:876ba416c547 | 18 | |
porizou3 | 0:876ba416c547 | 19 | /* --- モーター回転 --- */ |
porizou3 | 0:876ba416c547 | 20 | void rotate(float speed); |
porizou3 | 0:876ba416c547 | 21 | |
porizou3 | 0:876ba416c547 | 22 | /* --- モーターHブレーキ ---*/ |
porizou3 | 0:876ba416c547 | 23 | void brake(void); |
porizou3 | 0:876ba416c547 | 24 | |
porizou3 | 0:876ba416c547 | 25 | private: |
porizou3 | 0:876ba416c547 | 26 | |
porizou3 | 0:876ba416c547 | 27 | PwmOut pwm_; |
porizou3 | 0:876ba416c547 | 28 | DigitalOut fwd_; |
porizou3 | 0:876ba416c547 | 29 | DigitalOut rev_; |
porizou3 | 0:876ba416c547 | 30 | float frequency_; //PWM周波数 |
porizou3 | 0:876ba416c547 | 31 | |
porizou3 | 0:876ba416c547 | 32 | }; |
porizou3 | 0:876ba416c547 | 33 | |
porizou3 | 0:876ba416c547 | 34 | |
porizou3 | 0:876ba416c547 | 35 | #endif /* __motordriver_h */ |
porizou3 | 0:876ba416c547 | 36 | |
porizou3 | 0:876ba416c547 | 37 | |
porizou3 | 0:876ba416c547 | 38 | |
porizou3 | 0:876ba416c547 | 39 | |
porizou3 | 0:876ba416c547 | 40 | |
porizou3 | 0:876ba416c547 | 41 | |
porizou3 | 0:876ba416c547 | 42 | |
porizou3 | 0:876ba416c547 | 43 | |
porizou3 | 0:876ba416c547 | 44 | |
porizou3 | 0:876ba416c547 | 45 | |
porizou3 | 0:876ba416c547 | 46 | |
porizou3 | 0:876ba416c547 | 47 | |
porizou3 | 0:876ba416c547 | 48 | |
porizou3 | 0:876ba416c547 | 49 | |
porizou3 | 0:876ba416c547 | 50 | |
porizou3 | 0:876ba416c547 | 51 | |
porizou3 | 0:876ba416c547 | 52 | |
porizou3 | 0:876ba416c547 | 53 | |
porizou3 | 0:876ba416c547 | 54 | |
porizou3 | 0:876ba416c547 | 55 | |
porizou3 | 0:876ba416c547 | 56 | |
porizou3 | 0:876ba416c547 | 57 | #ifndef __motordriver_h |
porizou3 | 0:876ba416c547 | 58 | #define __motordriver_h |
porizou3 | 0:876ba416c547 | 59 | |
porizou3 | 0:876ba416c547 | 60 | /** |
porizou3 | 0:876ba416c547 | 61 | * Includes |
porizou3 | 0:876ba416c547 | 62 | */ |
porizou3 | 0:876ba416c547 | 63 | #include "mbed.h" |
porizou3 | 0:876ba416c547 | 64 | |
porizou3 | 0:876ba416c547 | 65 | class Motor { |
porizou3 | 0:876ba416c547 | 66 | |
porizou3 | 0:876ba416c547 | 67 | public: |
porizou3 | 0:876ba416c547 | 68 | /* |
porizou3 | 0:876ba416c547 | 69 | * pwm --- PwmOut pin |
porizou3 | 0:876ba416c547 | 70 | * fwd --- DigitalOut pin モーター正転 |
porizou3 | 0:876ba416c547 | 71 | * rev --- DigitalOut pin モーター逆転 |
porizou3 | 0:876ba416c547 | 72 | */ |
porizou3 | 0:876ba416c547 | 73 | Motor(PinName pwm , PinName fwd , PinName rev , float frequency); |
porizou3 | 0:876ba416c547 | 74 | |
porizou3 | 0:876ba416c547 | 75 | /* --- モーター回転 --- */ |
porizou3 | 0:876ba416c547 | 76 | void rotate(float speed); |
porizou3 | 0:876ba416c547 | 77 | |
porizou3 | 0:876ba416c547 | 78 | /* --- モーターHブレーキ ---*/ |
porizou3 | 0:876ba416c547 | 79 | void brake(void); |
porizou3 | 0:876ba416c547 | 80 | |
porizou3 | 0:876ba416c547 | 81 | private: |
porizou3 | 0:876ba416c547 | 82 | |
porizou3 | 0:876ba416c547 | 83 | PwmOut pwm_; |
porizou3 | 0:876ba416c547 | 84 | DigitalOut fwd_; |
porizou3 | 0:876ba416c547 | 85 | DigitalOut rev_; |
porizou3 | 0:876ba416c547 | 86 | float frequency_; //PWM周波数 |
porizou3 | 0:876ba416c547 | 87 | |
porizou3 | 0:876ba416c547 | 88 | }; |
porizou3 | 0:876ba416c547 | 89 | |
porizou3 | 0:876ba416c547 | 90 | |
porizou3 | 0:876ba416c547 | 91 | #endif /* __motordriver_h */ |
porizou3 | 0:876ba416c547 | 92 | |
porizou3 | 0:876ba416c547 | 93 | |
porizou3 | 0:876ba416c547 | 94 | |
porizou3 | 0:876ba416c547 | 95 | |
porizou3 | 0:876ba416c547 | 96 | |
porizou3 | 0:876ba416c547 | 97 | |
porizou3 | 0:876ba416c547 | 98 | |
porizou3 | 0:876ba416c547 | 99 | |
porizou3 | 0:876ba416c547 | 100 | |
porizou3 | 0:876ba416c547 | 101 | |
porizou3 | 0:876ba416c547 | 102 | |
porizou3 | 0:876ba416c547 | 103 | |
porizou3 | 0:876ba416c547 | 104 | |
porizou3 | 0:876ba416c547 | 105 | |
porizou3 | 0:876ba416c547 | 106 | |
porizou3 | 0:876ba416c547 | 107 | |
porizou3 | 0:876ba416c547 | 108 | |
porizou3 | 0:876ba416c547 | 109 | |
porizou3 | 0:876ba416c547 | 110 | |
porizou3 | 0:876ba416c547 | 111 | |
porizou3 | 0:876ba416c547 | 112 | |
porizou3 | 0:876ba416c547 | 113 |