toshi mura
/
NRP2020_main
gjyrjyykkudt
Motor/Motor.h@1:5b0303768126, 2020-01-21 (annotated)
- Committer:
- M_souta
- Date:
- Tue Jan 21 11:10:33 2020 +0000
- Revision:
- 1:5b0303768126
- Parent:
- 0:db8d4af513c0
- Child:
- 2:32d2cd7d744b
lll
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
M_souta | 0:db8d4af513c0 | 1 | #ifndef MOTOR_H_ |
M_souta | 0:db8d4af513c0 | 2 | #define MOTOR_H_ |
M_souta | 0:db8d4af513c0 | 3 | |
M_souta | 0:db8d4af513c0 | 4 | #include "mbed.h" |
M_souta | 0:db8d4af513c0 | 5 | |
M_souta | 0:db8d4af513c0 | 6 | typedef enum dire { |
M_souta | 0:db8d4af513c0 | 7 | FREE = 0, |
M_souta | 0:db8d4af513c0 | 8 | FOR = 1, |
M_souta | 0:db8d4af513c0 | 9 | BACK = 2, |
M_souta | 0:db8d4af513c0 | 10 | BRAKE = 3, |
M_souta | 0:db8d4af513c0 | 11 | }dire; |
M_souta | 0:db8d4af513c0 | 12 | |
M_souta | 0:db8d4af513c0 | 13 | class MOTOR { |
M_souta | 0:db8d4af513c0 | 14 | public: |
M_souta | 0:db8d4af513c0 | 15 | // |
M_souta | 0:db8d4af513c0 | 16 | MOTOR(PinName D1, PinName D2, PinName pwm); |
M_souta | 0:db8d4af513c0 | 17 | /* direction |
M_souta | 0:db8d4af513c0 | 18 | FREE |
M_souta | 0:db8d4af513c0 | 19 | FOR |
M_souta | 0:db8d4af513c0 | 20 | BACK |
M_souta | 0:db8d4af513c0 | 21 | BRAKE |
M_souta | 0:db8d4af513c0 | 22 | */ |
M_souta | 0:db8d4af513c0 | 23 | /* pwm |
M_souta | 1:5b0303768126 | 24 | pwm is 0 ~ 255(%) |
M_souta | 0:db8d4af513c0 | 25 | */ |
M_souta | 0:db8d4af513c0 | 26 | // durection and pwm set |
M_souta | 0:db8d4af513c0 | 27 | void Dir(dire mode, uint8_t pwm); |
M_souta | 0:db8d4af513c0 | 28 | // direction set |
M_souta | 0:db8d4af513c0 | 29 | void Dir(dire mode); |
M_souta | 0:db8d4af513c0 | 30 | // pwm set |
M_souta | 0:db8d4af513c0 | 31 | void PWM(uint8_t pwm); |
M_souta | 0:db8d4af513c0 | 32 | |
M_souta | 0:db8d4af513c0 | 33 | private: |
M_souta | 0:db8d4af513c0 | 34 | DigitalOut D1_; |
M_souta | 0:db8d4af513c0 | 35 | DigitalOut D2_; |
M_souta | 0:db8d4af513c0 | 36 | PwmOut pwm_; |
M_souta | 0:db8d4af513c0 | 37 | }; |
M_souta | 0:db8d4af513c0 | 38 | |
M_souta | 0:db8d4af513c0 | 39 | #endif //MOTOR_H_ |
M_souta | 0:db8d4af513c0 | 40 |