Interrupt
Dependencies: mbed
Revision 0:6643d1c94bd0, committed 2015-10-15
- Comitter:
- fkgjh
- Date:
- Thu Oct 15 10:53:41 2015 +0000
- Commit message:
- Interrupt;
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 |
diff -r 000000000000 -r 6643d1c94bd0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 15 10:53:41 2015 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +InterruptIn SW7(PB_3); +InterruptIn SW6(PA_10); + +Timer timer; +static double tidSek; + +void startKlokke() +{ + timer.reset(); + timer.start(); +} + +void stopKlokke() +{ + timer.stop(); + tidSek=timer.read_ms()/1000.0; + printf("tid %.3f sek\r\n", tidSek); +} + +int main() +{ + SW7.fall(&startKlokke); + SW6.fall(&stopKlokke); + + while (true) + { + wait_ms(200); + } +} \ No newline at end of file
diff -r 000000000000 -r 6643d1c94bd0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 15 10:53:41 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad \ No newline at end of file