Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:a84599c324fb, committed 2012-08-29
- Comitter:
- p07gbar
- Date:
- Wed Aug 29 11:51:28 2012 +0000
- Commit message:
- Initial commit - Working
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PWMAverage.lib Wed Aug 29 11:51:28 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/p07gbar/code/PWMAverage/#449ea283d634
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Aug 29 11:51:28 2012 +0000
@@ -0,0 +1,33 @@
+// Measure and print the average duty cycle of a signal connected to p29 and p30 (together) while the button (p16) is pulled high
+
+#include "mbed.h"
+#include "PWMAverage.h"
+
+DigitalOut myled(LED1);
+
+PWMAverage pa(p29,p30);
+
+DigitalIn button (p16);
+
+Timer tmr;
+
+int main()
+{
+ button.mode(PullDown);
+ while(1)
+ {
+ pa.reset();
+
+ while (!button) {}
+ pa.start();
+ tmr.start();
+ myled=1;
+
+ while (button) {}
+ pa.stop();
+ tmr.stop();
+ myled=0;
+
+ printf("Average dudy cycle over %d us was %.4f\n\r",tmr.read_us(),pa.read());
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 29 11:51:28 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6 \ No newline at end of file