Example code for 'Mechatronics Class'

main.cpp

Committer:
ykuroda
Date:
2019-10-14
Revision:
2:83a817de162e
Parent:
0:8c7b073576c5

File content as of revision 2:83a817de162e:

#include "mbed.h"
#include "counter.h"

PwmOut pwm(D10);    // wire to tie D10, D12, and D13(LED1)
DigitalIn led(LED1);

int main() {
    Counter count(D12);
    count = 0;

    pwm.period(0.1);
    pwm = 0.5;

    while(1) {
        printf("Count so far: %d\n", int(count));
        wait(1);
    }
}