Mechatro example program

Dependencies:   mbed

main.cpp

Committer:
ykuroda
Date:
2017-10-05
Revision:
0:a17e11284fc5

File content as of revision 0:a17e11284fc5:

// 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
    }
}