![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
hhh
main.cpp@1:4346149b11d2, 2016-12-01 (annotated)
- Committer:
- 2bv14ei073
- Date:
- Thu Dec 01 06:13:26 2016 +0000
- Revision:
- 1:4346149b11d2
- Parent:
- 0:5d419a46e629
timer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
2bv14ei073 | 0:5d419a46e629 | 1 | #include "mbed.h" |
2bv14ei073 | 0:5d419a46e629 | 2 | |
2bv14ei073 | 0:5d419a46e629 | 3 | |
2bv14ei073 | 0:5d419a46e629 | 4 | Timer timer; |
2bv14ei073 | 0:5d419a46e629 | 5 | DigitalOut led(LED1); |
2bv14ei073 | 0:5d419a46e629 | 6 | int begin, end; |
2bv14ei073 | 0:5d419a46e629 | 7 | |
2bv14ei073 | 0:5d419a46e629 | 8 | int main() { |
2bv14ei073 | 0:5d419a46e629 | 9 | timer.start(); |
2bv14ei073 | 0:5d419a46e629 | 10 | begin = timer.read_us(); |
2bv14ei073 | 0:5d419a46e629 | 11 | led = !led; |
2bv14ei073 | 0:5d419a46e629 | 12 | end = timer.read_us(); |
2bv14ei073 | 0:5d419a46e629 | 13 | printf("Toggle the led takes %d us", end - begin); |
2bv14ei073 | 0:5d419a46e629 | 14 | } |
2bv14ei073 | 0:5d419a46e629 | 15 |