
Timer Hello World
Fork of Timer_HelloWorld by
Use
The Timer class is used to measure time. The time will be the amount of time between when the start() and stop() functions are run. The Timer class counts from 0 up.
API
API reference.
Import librarymbed
main.cpp@0:27e1de20d3cb, 2013-02-13 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Feb 13 17:28:57 2013 +0000
- Revision:
- 0:27e1de20d3cb
- Child:
- 2:9152128dba25
Timer Hello World
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:27e1de20d3cb | 1 | #include "mbed.h" |
mbed_official | 0:27e1de20d3cb | 2 | |
mbed_official | 0:27e1de20d3cb | 3 | Timer t; |
mbed_official | 0:27e1de20d3cb | 4 | |
mbed_official | 0:27e1de20d3cb | 5 | int main() { |
mbed_official | 0:27e1de20d3cb | 6 | t.start(); |
mbed_official | 0:27e1de20d3cb | 7 | printf("Hello World!\n"); |
mbed_official | 0:27e1de20d3cb | 8 | t.stop(); |
mbed_official | 0:27e1de20d3cb | 9 | printf("The time taken was %f seconds\n", t.read()); |
mbed_official | 0:27e1de20d3cb | 10 | } |