NUCLEO-F042K6 Simple demo blinking LED using waits

Dependencies:   mbed

Committer:
vodsejak
Date:
Wed Jan 31 20:26:49 2018 +0000
Revision:
3:deb248262461
Parent:
2:fd849f6babbb
v2.0; added commentary;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vodsejak 0:3e4e987e751b 1 #include "mbed.h" // import of mbed library (required)
vodsejak 0:3e4e987e751b 2
vodsejak 3:deb248262461 3 /*******************************************************************************
vodsejak 3:deb248262461 4
vodsejak 3:deb248262461 5 EXAMPLE DESCRIPTION
vodsejak 3:deb248262461 6
vodsejak 3:deb248262461 7 Simple example which periodically turns LED on board ON/OFF using SW solution.
vodsejak 3:deb248262461 8
vodsejak 3:deb248262461 9 *******************************************************************************/
vodsejak 3:deb248262461 10
vodsejak 3:deb248262461 11 DigitalOut LED(LED1); // definition of digital out pin
vodsejak 0:3e4e987e751b 12
vodsejak 0:3e4e987e751b 13 int main()
vodsejak 0:3e4e987e751b 14 {
vodsejak 0:3e4e987e751b 15 while(1) {
vodsejak 2:fd849f6babbb 16 for(int i=0; i<2; i++) {
vodsejak 0:3e4e987e751b 17 LED = 1; // turn LED on
vodsejak 2:fd849f6babbb 18 wait_ms(200); // wait 200 ms
vodsejak 0:3e4e987e751b 19 LED = 0; // turnd LED off
vodsejak 2:fd849f6babbb 20 wait_ms(200); // wait 200 ms
vodsejak 0:3e4e987e751b 21 }
vodsejak 2:fd849f6babbb 22 for(int i=0; i<2; i++) {
vodsejak 0:3e4e987e751b 23 LED = 1; // turn LED on
vodsejak 0:3e4e987e751b 24 wait_us(1000000); // wait 1000000 us
vodsejak 0:3e4e987e751b 25 LED = 0; // turnd LED off
vodsejak 0:3e4e987e751b 26 wait_us(1000000); // wait 1000000 us
vodsejak 0:3e4e987e751b 27 }
vodsejak 0:3e4e987e751b 28 }
vodsejak 0:3e4e987e751b 29 }