kumaresh kj
/
NucleoF103_blink_led
LED blink example with different type of initializing
main.cpp@0:7bf4747cc128, 2015-04-17 (annotated)
- Committer:
- kumaresh
- Date:
- Fri Apr 17 12:33:12 2015 +0000
- Revision:
- 0:7bf4747cc128
LED blink example with different initializing example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kumaresh | 0:7bf4747cc128 | 1 | #include "mbed.h" |
kumaresh | 0:7bf4747cc128 | 2 | |
kumaresh | 0:7bf4747cc128 | 3 | // different type of initializing LED in NUCLEO board |
kumaresh | 0:7bf4747cc128 | 4 | |
kumaresh | 0:7bf4747cc128 | 5 | DigitalOut myled1(LED1); // |
kumaresh | 0:7bf4747cc128 | 6 | DigitalOut myled2(PA_5); // LED connected to pin PA5 in board |
kumaresh | 0:7bf4747cc128 | 7 | DigitalOut myled3(D13); // same as PA5. D13 arduino pin format |
kumaresh | 0:7bf4747cc128 | 8 | |
kumaresh | 0:7bf4747cc128 | 9 | |
kumaresh | 0:7bf4747cc128 | 10 | int main() { |
kumaresh | 0:7bf4747cc128 | 11 | while(1) { |
kumaresh | 0:7bf4747cc128 | 12 | myled1 = 1; // LED is ON |
kumaresh | 0:7bf4747cc128 | 13 | wait(0.2); // 200 ms delay function. 1 is equal to one second |
kumaresh | 0:7bf4747cc128 | 14 | |
kumaresh | 0:7bf4747cc128 | 15 | myled2 = 0; // LED is OFF |
kumaresh | 0:7bf4747cc128 | 16 | wait(1); // 1 sec |
kumaresh | 0:7bf4747cc128 | 17 | |
kumaresh | 0:7bf4747cc128 | 18 | myled3 = 1; // LED is ON |
kumaresh | 0:7bf4747cc128 | 19 | wait(0.8); // 800 ms |
kumaresh | 0:7bf4747cc128 | 20 | |
kumaresh | 0:7bf4747cc128 | 21 | myled1 = 0; // LED is OFF |
kumaresh | 0:7bf4747cc128 | 22 | wait(1); // 1 sec |
kumaresh | 0:7bf4747cc128 | 23 | } |
kumaresh | 0:7bf4747cc128 | 24 | } |