Simon Ford
/
PwmIn_HelloWorld
A Hello World example to use PwmIn to read a PWM input signals
Diff: main.cpp
- Revision:
- 0:f52f1e22f72d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 02 18:20:01 2010 +0000 @@ -0,0 +1,21 @@ +// 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); + } +}