NUCLEO-F042K6 Simple demo blinking LED using waits

Dependencies:   mbed

main.cpp

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

File content as of revision 0:3e4e987e751b:

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

DigitalOut LED(LED1);

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