Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
clock.cpp@0:293ea2789df6, 2019-04-11 (annotated)
- Committer:
- JamB
- Date:
- Thu Apr 11 22:17:06 2019 +0000
- Revision:
- 0:293ea2789df6
Clock code for project
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JamB | 0:293ea2789df6 | 1 | #include "mbed.h" |
| JamB | 0:293ea2789df6 | 2 | #include "clock.h" |
| JamB | 0:293ea2789df6 | 3 | bool istick; |
| JamB | 0:293ea2789df6 | 4 | Ticker ticker; //class, instance of class |
| JamB | 0:293ea2789df6 | 5 | |
| JamB | 0:293ea2789df6 | 6 | void tick() |
| JamB | 0:293ea2789df6 | 7 | { |
| JamB | 0:293ea2789df6 | 8 | istick=true; |
| JamB | 0:293ea2789df6 | 9 | } |
| JamB | 0:293ea2789df6 | 10 | |
| JamB | 0:293ea2789df6 | 11 | void set_tick_(float set_tick) //constructor |
| JamB | 0:293ea2789df6 | 12 | { //used to setup the clock |
| JamB | 0:293ea2789df6 | 13 | ticker.attach(&tick, set_tick); |
| JamB | 0:293ea2789df6 | 14 | } |
| JamB | 0:293ea2789df6 | 15 | |
| JamB | 0:293ea2789df6 | 16 | bool tock() |
| JamB | 0:293ea2789df6 | 17 | { //used to run the code |
| JamB | 0:293ea2789df6 | 18 | if (istick) |
| JamB | 0:293ea2789df6 | 19 | { |
| JamB | 0:293ea2789df6 | 20 | istick =false; |
| JamB | 0:293ea2789df6 | 21 | return true; |
| JamB | 0:293ea2789df6 | 22 | } |
| JamB | 0:293ea2789df6 | 23 | return false; |
| JamB | 0:293ea2789df6 | 24 | } |
| JamB | 0:293ea2789df6 | 25 |