Timer
Dependencies: mbed
main.cpp@0:634e87e3d30e, 2016-11-06 (annotated)
- Committer:
- Mattinico
- Date:
- Sun Nov 06 12:40:19 2016 +0000
- Revision:
- 0:634e87e3d30e
k
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mattinico | 0:634e87e3d30e | 1 | /* Program Example 3: A simple Timer example, from mbed website. |
Mattinico | 0:634e87e3d30e | 2 | Activate Tera Term terminal to test. |
Mattinico | 0:634e87e3d30e | 3 | */ |
Mattinico | 0:634e87e3d30e | 4 | #include "mbed.h" |
Mattinico | 0:634e87e3d30e | 5 | Timer t; // define Timer with name â€oet†|
Mattinico | 0:634e87e3d30e | 6 | Serial pc(USBTX, USBRX); |
Mattinico | 0:634e87e3d30e | 7 | |
Mattinico | 0:634e87e3d30e | 8 | int main() |
Mattinico | 0:634e87e3d30e | 9 | { |
Mattinico | 0:634e87e3d30e | 10 | t.start(); //start the timer |
Mattinico | 0:634e87e3d30e | 11 | pc.printf("Forza NAPOLI!\n\r"); |
Mattinico | 0:634e87e3d30e | 12 | t.stop(); //stop the timer |
Mattinico | 0:634e87e3d30e | 13 | pc.printf("The time taken was %f seconds\n\r", t.read()); //print to pc |
Mattinico | 0:634e87e3d30e | 14 | } |