![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
trtr
Dependencies: mbed
main.cpp
- Committer:
- simwiu
- Date:
- 2015-11-12
- Revision:
- 0:5a04d10db6b0
File content as of revision 0:5a04d10db6b0:
#include "mbed.h" InterruptIn SW7(PB_3); InterruptIn SW6(PA_10); static double tidSek; //static double meter=5; //static double kmh=3.6; //static double v; Timer timer; void startKlokke() { timer.reset(); timer.start(); } void stopKlokke() { timer.stop(); tidSek=timer.read_ms()/1000.0; //v=meter/tidSek*kmh; printf("Km/t %.3f \r\n", 5/tidSek*3.6 ); } int main () { SW7.fall(&startKlokke); SW6.fall(&stopKlokke); while (true) { timer.reset(); while (SW7==1){;}; timer.start(); while (SW6==1){;}; timer.stop(); wait_ms(200); } }