Test of Ticker interface

Dependencies:   mbed

Ticker interface: https://developer.mbed.org/handbook/Ticker

main.cpp

Committer:
66keg
Date:
2015-05-05
Revision:
0:be44cd8797f6

File content as of revision 0:be44cd8797f6:

#include "mbed.h"

Serial pc(USBTX, USBRX);
Ticker ticker1, ticker2;

void myFunc1()
{
 pc.printf("ticker1\n");
}

void myFunc2()
{
 pc.printf("ticker2\n");
}
 
int main() {
    ticker1.attach(&myFunc1, 1.0); // call myFunc1 every 1.0 seconds
    ticker2.attach(&myFunc2, 2.0); // call myFunc2 every 2.0 seconds
    
    // main loop
    while(1) {
        pc.printf("main loop\n");
        wait(5.0);
    }
}