timer
Dependencies: mbed
Revision 0:ab580b4ace8c, committed 2016-05-05
- Comitter:
- muchaon
- Date:
- Thu May 05 09:28:54 2016 +0000
- Child:
- 1:4592d89c777a
- Commit message:
- 123456;
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 Thu May 05 09:28:54 2016 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +DigitalOut myLed(LED1); +DigitalIn tlacitko(USER_BUTTON); +Serial pc( SERIAL_TX , SERIAL_RX ); +Timer casovac; + +bool tlac_klik, tlac_ted; +float zacatek, konec, cas; + + +int main() { + casovac.start(); + while(1){ + tlac_klik = tlac_ted; //ulozit akt. stav tlacitka + tlac_ted = tlacitko; //ulozit stav. stav tlacitka + if ((tlac_ted == false) && (tlac_klik == true)) { // akce pri stisknuti tlacitka + zacatek = casovac.read(); //ulozit dobu stistku + pc.printf("zacatek: %f \t" , zacatek); + + } + if ((tlac_ted == true) && (tlac_klik == false)) { //akce pri uvolneni tlacitka + konec = casovac.read(); // ulozit dobu uloz. + pc.printf("konec: %f \t" , konec); + cas= konec - zacatek; + pc.printf("interval %f \n\r " , cas); + } + + } + } + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 05 09:28:54 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file