Using on board MMA8451Q on FRK25

Dependencies:   MMA8451Q mbed

main.cpp

Committer:
chris
Date:
2012-10-12
Revision:
1:bbb4d2753b6b
Parent:
0:5e8c7a36cb58
Child:
2:b085bc47e75b

File content as of revision 1:bbb4d2753b6b:

#include "mbed.h"

Ticker tick;
DigitalOut led1(LED_RED);
DigitalOut led2(LED_GREEN);

void flip()
{
    led2 = !led2;
}

int main()
{
    tick.attach(&flip, 0.7); // setup ticker to call flip led2 after 0.7 seconds

    // spin in a main loop.
    while(1) {
        led1 = !led1;
        wait (0.3); // flip led1 every 0.3 seconds
    }
}