小日向さんのMDライブラリ
Dependents: 00_yotsuba 10_motor-test 00_yotsuba 200_yotsuba_21 ... more
Diff: kohiMD.cpp
- Revision:
- 7:d7e8402e6869
- Parent:
- 6:d4d97efd8881
- Child:
- 8:ba7b31b888f2
diff -r d4d97efd8881 -r d7e8402e6869 kohiMD.cpp --- a/kohiMD.cpp Thu Mar 04 11:57:50 2021 +0000 +++ b/kohiMD.cpp Thu Mar 04 14:21:34 2021 +0000 @@ -11,16 +11,20 @@ void KohiMD::setSpeed(double speed_) { - speed = speed_; + _pwmMD = mdlpf.path_value(speed); + _pwmMD = 0.5 + _pwmMD /2.0; + if(_pwmMD > 0.9) _pwmMD = 0.9; + if(_pwmMD < 0.1) _pwmMD = 0.1; + pwmMD.write(speed); printf("%d\r\n",(int)(speed*10)); - MDloop(); +// MDloop(); } - -void KohiMD::MDloop() -{ - _pwmMD = mdlpf.path_value(speed); - _pwmMD = 0.5 + _pwmMD /2.0; - if(_pwmMD > 0.9) _pwmMD = 0.9; - if(_pwmMD < 0.1) _pwmMD = 0.1; - pwmMD.write(0.0); -} \ No newline at end of file +// +//void KohiMD::MDloop() +//{ +// _pwmMD = mdlpf.path_value(speed); +// _pwmMD = 0.5 + _pwmMD /2.0; +// if(_pwmMD > 0.9) _pwmMD = 0.9; +// if(_pwmMD < 0.1) _pwmMD = 0.1; +// pwmMD.write(speed); +//} \ No newline at end of file