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

Dependencies:   mbed PwmIn

Files at this revision

API Documentation at this revision

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

PwmIn.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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