Applied engineering Team / Mbed 2 deprecated VT2_Ivana_Mihalj

Dependencies:   mbed

main.cpp

Committer:
imihalj
Date:
2016-11-10
Revision:
7:c56b212b084e
Parent:
6:ca9ae5ce232d
Child:
8:e81d54d7ced6

File content as of revision 7:c56b212b084e:

#include "mbed.h"
Ticker flipper1;
Ticker flipper2;
DigitalOut led1(p5);
DigitalOut led2(p6);
void flip1()   // flip 1 function
{
    led1 = !led1;
}
void flip2()   // flip 2 function
{
    led2 = !led2;
}
int main()
{
    led1 = 0;
    led2 = 0;
    flipper1.attach(&flip1, 0.2); // the address of the
// function to be attached
// and the interval (sec)
    flipper2.attach(&flip2, 1.0);
// spin in a main loop
// flipper will interrupt it to call flip
    while(1) {
        wait(0.2);
    }
}
}