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:7850f26e290c, committed 2019-05-01
- Comitter:
- hisyamfs
- Date:
- Wed May 01 11:59:30 2019 +0000
- Commit message:
- jancuk;
Changed in this revision
| 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/main.cpp Wed May 01 11:59:30 2019 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+InterruptIn line(PA_0);
+Timer timer;
+volatile float dur = 0.0f;
+int printed = 0;
+
+void start() {
+ timer.reset();
+ timer.start();
+}
+
+void end() {
+ timer.stop();
+ dur = timer.read();
+}
+
+int main() {
+ line.fall(&start);
+ line.rise(&end);
+ while (1) {
+ if (!printed) {
+ printf("%.2f\n", dur);
+ printed = 1;
+ }
+ else {
+ printed = 0;
+ }
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed May 01 11:59:30 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file