![](/media/cache/profiles/c51ce410c124a10e0db5e4b97fc2af39.50x50_q85.jpg)
A Hello World example to use PwmIn to read a PWM input signals
Revision 0:f52f1e22f72d, committed 2010-09-02
- Comitter:
- simon
- Date:
- Thu Sep 02 18:20:01 2010 +0000
- Commit message:
- Example using the PwmIn published as a library
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PwmIn.lib Thu Sep 02 18:20:01 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/PwmIn/#6d68eb9b6bbb
--- /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); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 02 18:20:01 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/74b8d43b5817