NUCLEO-F042K6 Simple demo writing Timer time to UART periodically using Ticker
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:e80bdfa0212c
- Parent:
- 1:3b8cd8e8ce53
- Child:
- 3:906776a3481e
diff -r 3b8cd8e8ce53 -r e80bdfa0212c main.cpp --- a/main.cpp Sat Feb 10 15:58:54 2018 +0000 +++ b/main.cpp Sat Feb 10 15:59:25 2018 +0000 @@ -15,6 +15,7 @@ // returns Timer value int getTimerVal(Timer *tim) { int time = tim->read_us(); + // reset when overflow if (time<0){ tim->reset(); time = tim->read_us();