example of using the ticker object

Dependents:   Nucleo_gyro

main.cpp

Committer:
tulanthoar
Date:
2017-04-21
Revision:
1:ce7493c6a648
Parent:
0:573c02b712fe

File content as of revision 1:ce7493c6a648:

#include "mbed.h"

Ticker toggle_led_ticker;

DigitalOut led1(LED1);

void toggle_led() {
    led1 = !led1;
}

int main() {
    // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
    toggle_led_ticker.attach(&toggle_led, 0.1);
    while (true) {
        // Do other things...
    }
}