taiyou komazawa
/
Nucleo_fliping_arm
2018 HongoMechaTech A
lib/StraightMD.cpp@0:e83b840a5f86, 2018-09-18 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Tue Sep 18 03:11:01 2018 +0000
- Revision:
- 0:e83b840a5f86
????????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Komazawa_sun | 0:e83b840a5f86 | 1 | #include"mbed.h" |
Komazawa_sun | 0:e83b840a5f86 | 2 | #include"StraightMD.h" |
Komazawa_sun | 0:e83b840a5f86 | 3 | StraightMD::StraightMD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) |
Komazawa_sun | 0:e83b840a5f86 | 4 | { |
Komazawa_sun | 0:e83b840a5f86 | 5 | Pwm.period(0.0001); |
Komazawa_sun | 0:e83b840a5f86 | 6 | } |
Komazawa_sun | 0:e83b840a5f86 | 7 | |
Komazawa_sun | 0:e83b840a5f86 | 8 | |
Komazawa_sun | 0:e83b840a5f86 | 9 | void StraightMD::drive(double duty) |
Komazawa_sun | 0:e83b840a5f86 | 10 | { |
Komazawa_sun | 0:e83b840a5f86 | 11 | if(duty > 0) |
Komazawa_sun | 0:e83b840a5f86 | 12 | { |
Komazawa_sun | 0:e83b840a5f86 | 13 | Dere = 0; |
Komazawa_sun | 0:e83b840a5f86 | 14 | Pwm = abs(duty); |
Komazawa_sun | 0:e83b840a5f86 | 15 | } |
Komazawa_sun | 0:e83b840a5f86 | 16 | else |
Komazawa_sun | 0:e83b840a5f86 | 17 | { |
Komazawa_sun | 0:e83b840a5f86 | 18 | Dere = 1; |
Komazawa_sun | 0:e83b840a5f86 | 19 | Pwm = abs(duty); |
Komazawa_sun | 0:e83b840a5f86 | 20 | } |
Komazawa_sun | 0:e83b840a5f86 | 21 | } |
Komazawa_sun | 0:e83b840a5f86 | 22 | |
Komazawa_sun | 0:e83b840a5f86 | 23 | void StraightMD::brake(double duty){ |
Komazawa_sun | 0:e83b840a5f86 | 24 | } |
Komazawa_sun | 0:e83b840a5f86 | 25 | |
Komazawa_sun | 0:e83b840a5f86 | 26 | |
Komazawa_sun | 0:e83b840a5f86 | 27 | |
Komazawa_sun | 0:e83b840a5f86 | 28 | void StraightMD::free() |
Komazawa_sun | 0:e83b840a5f86 | 29 | { |
Komazawa_sun | 0:e83b840a5f86 | 30 | } |