solve the time of a loop 0:100
Dependencies: mbed
Fork of Timer_HelloWorld by
Diff: main.cpp
- Revision:
- 2:c979a2f3b744
- Parent:
- 0:27e1de20d3cb
diff -r d76f5570bd21 -r c979a2f3b744 main.cpp --- a/main.cpp Sat Sep 20 23:00:21 2014 +0000 +++ b/main.cpp Tue Oct 21 15:28:28 2014 +0000 @@ -1,10 +1,20 @@ +/************************************** +*file name: base time count +*Creator:JacobShi +*Time:2014/10/20 +*Description: solve the time of a loop + ***************************************/ #include "mbed.h" - Timer t; - -int main() { +int i; +int timedata; +int main(void) +{ + + t.reset(); t.start(); - printf("Hello World!\n"); + for(i=0;i<100;i++); t.stop(); - printf("The time taken was %f seconds\n", t.read()); -} + timedata=t.read_us(); + printf("the time of the loos 0~99 is :%d us\n",timedata); +} \ No newline at end of file