Mark Schwarzer / Mbed 2 deprecated Schwarzer_A3_2_Tickers

Dependencies:   mbed A3_1_Single_Timer

main.cpp

Committer:
markschwarzer
Date:
2020-10-06
Revision:
2:de9d94dc0454
Parent:
1:76d11e984b8d
Child:
3:d90d04dce9f2

File content as of revision 2:de9d94dc0454:


#include "mbed.h"
Ticker tickerLED2;  //creat ticker object
DigitalOut LEDOut2(LED2);

void changeLED2()  //the function that will be called by the ticker object.
{
    LEDOut2 = !LEDOut2;
}

int main()
{
    tickerLED2.attach(&changeLED2,0.2); //the address of the function to call
    //and the interval in seconds between
    //calls to that function

    while(1) {
        wait(0.1);
        wait(0.1);
        wait(0.1);
        wait(0.1);
        wait(0.1);
        //the main loop is spinning every 500ms, but the LED needs to go faster!
    } //while
}