NUCLEO-F042K6 Simple demo blinking LED using waits
Dependencies: mbed
main.cpp@2:fd849f6babbb, 2018-01-31 (annotated)
- Committer:
- vodsejak
- Date:
- Wed Jan 31 19:57:42 2018 +0000
- Revision:
- 2:fd849f6babbb
- Parent:
- 0:3e4e987e751b
- Child:
- 3:deb248262461
v1.2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vodsejak | 0:3e4e987e751b | 1 | #include "mbed.h" // import of mbed library (required) |
vodsejak | 0:3e4e987e751b | 2 | |
vodsejak | 0:3e4e987e751b | 3 | DigitalOut LED(LED1); |
vodsejak | 0:3e4e987e751b | 4 | |
vodsejak | 0:3e4e987e751b | 5 | int main() |
vodsejak | 0:3e4e987e751b | 6 | { |
vodsejak | 0:3e4e987e751b | 7 | while(1) { |
vodsejak | 2:fd849f6babbb | 8 | for(int i=0; i<2; i++) { |
vodsejak | 0:3e4e987e751b | 9 | LED = 1; // turn LED on |
vodsejak | 2:fd849f6babbb | 10 | wait_ms(200); // wait 200 ms |
vodsejak | 0:3e4e987e751b | 11 | LED = 0; // turnd LED off |
vodsejak | 2:fd849f6babbb | 12 | wait_ms(200); // wait 200 ms |
vodsejak | 0:3e4e987e751b | 13 | } |
vodsejak | 2:fd849f6babbb | 14 | for(int i=0; i<2; i++) { |
vodsejak | 0:3e4e987e751b | 15 | LED = 1; // turn LED on |
vodsejak | 0:3e4e987e751b | 16 | wait_us(1000000); // wait 1000000 us |
vodsejak | 0:3e4e987e751b | 17 | LED = 0; // turnd LED off |
vodsejak | 0:3e4e987e751b | 18 | wait_us(1000000); // wait 1000000 us |
vodsejak | 0:3e4e987e751b | 19 | } |
vodsejak | 0:3e4e987e751b | 20 | } |
vodsejak | 0:3e4e987e751b | 21 | } |