James Bartholomew / Clock3

clock.cpp

Committer:
JamB
Date:
2019-04-11
Revision:
0:293ea2789df6
Child:
1:bb3ab1744634

File content as of revision 0:293ea2789df6:

#include "mbed.h"
#include "clock.h"
    bool istick;
    Ticker ticker; //class, instance of class

void tick()
{
    istick=true;
}

void set_tick_(float set_tick) //constructor
{   //used to setup the clock
    ticker.attach(&tick, set_tick);
}
    
bool tock()
{   //used to run the code 
    if (istick)
    {
    istick =false;
    return true;
    }
    return false;
}