NUCLEO-F042K6 Simple demo blinking LED using waits

Dependencies:   mbed

main.cpp

Committer:
vodsejak
Date:
2018-01-31
Revision:
2:fd849f6babbb
Parent:
0:3e4e987e751b
Child:
3:deb248262461

File content as of revision 2:fd849f6babbb:

#include "mbed.h" // import of mbed library (required)

DigitalOut LED(LED1);

int main()
{
    while(1) {
        for(int i=0; i<2; i++) {
            LED = 1; // turn LED on
            wait_ms(200); // wait 200 ms
            LED = 0; // turnd LED off
            wait_ms(200); // wait 200 ms
        }
        for(int i=0; i<2; i++) {
            LED = 1; // turn LED on
            wait_us(1000000); // wait 1000000 us
            LED = 0; // turnd LED off
            wait_us(1000000); // wait 1000000 us
        }
    }
}