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.
main.cpp
00001 #include "mbed.h" 00002 00003 InterruptIn line(PA_0); 00004 Timer timer; 00005 volatile float dur = 0.0f; 00006 int printed = 0; 00007 00008 void start() { 00009 timer.reset(); 00010 timer.start(); 00011 } 00012 00013 void end() { 00014 timer.stop(); 00015 dur = timer.read(); 00016 } 00017 00018 int main() { 00019 line.fall(&start); 00020 line.rise(&end); 00021 while (1) { 00022 if (!printed) { 00023 printf("%.2f\n", dur); 00024 printed = 1; 00025 } 00026 else { 00027 printed = 0; 00028 } 00029 } 00030 } 00031
Generated on Fri Jul 15 2022 07:37:18 by
1.7.2