A Hello World example to use PwmIn to read a PWM input signals

Dependencies:   mbed PwmIn

main.cpp

Committer:
simon
Date:
2010-09-02
Revision:
0:f52f1e22f72d

File content as of revision 0:f52f1e22f72d:

// Example using PwmIn interface library, sford
//  - Note: uses InterruptIn, so not available on p19/p20

#include "mbed.h"
#include "PwmIn.h"

PwmOut x(p21);
PwmOut y(p22);

PwmIn a(p5);
PwmIn b(p6);

int main() {
    x = 0.5;
    y = 0.2;
    while(1) {
        printf("a: pw = %f, period = %f\n", a.pulsewidth(), a.period());
        printf("b: pw = %f, period = %f\n", b.pulsewidth(), b.period());
        wait(2);
    }
}