Yoji KURODA
/
Mechatro_MotorControl
Mechatro example program
Diff: main.cpp
- Revision:
- 0:a17e11284fc5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 05 07:50:42 2017 +0000 @@ -0,0 +1,23 @@ +// Motor Control ... Mechatronics example program +// +// 2017.10.05 ... Y.Kuroda +// +#include "mbed.h" + +PwmOut a1(D1); +DigitalOut a2(D12); + +int main() { + + a1.period_ms(1); + + while(1) { + a1 = 0.1; // duty is 10% + a2 = 0; + wait(3); // 3 s + + a1 = 0.9; // duty is 10%!!! + a2 = 1; + wait(3); // 3 sec + } +}