Simon Ford
/
PwmIn_HelloWorld
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
diff -r 000000000000 -r f52f1e22f72d PwmIn.lib --- /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
diff -r 000000000000 -r f52f1e22f72d main.cpp --- /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); + } +}
diff -r 000000000000 -r f52f1e22f72d mbed.bld --- /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