James Bartholomew / Clock
Committer:
JamB
Date:
Thu Apr 11 22:17:06 2019 +0000
Revision:
0:293ea2789df6
Clock code for project

Who changed what in which revision?

UserRevisionLine numberNew 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