James Bartholomew / Clock3

clock.cpp

Committer:
JamB
Date:
2019-04-15
Revision:
1:bb3ab1744634
Parent:
0:293ea2789df6

File content as of revision 1:bb3ab1744634:

#include "mbed.h"
#include "clock.h"
    bool istick;
    bool istickdisp;
    Ticker ticker; //class, instance of class
    Ticker tickerDisp;
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;
}


void tickdisp()
{
    istickdisp=true;
}

void set_tick_disp(float set_tickdisp) //constructor
{   //used to setup the clock
    tickerDisp.attach(&tickdisp, set_tickdisp);
}
    
bool tockdisp()
{   //used to run the code 
    if (istickdisp)
    {
    istickdisp =false;
    return true;
    }
    return false;
}