Wilco Bonestroo
/
Nucleo_blink_led
Blink example
main.cpp@0:0d2f27f56dfa, 2015-01-12 (annotated)
- Committer:
- WilcoBonestroo
- Date:
- Mon Jan 12 14:37:35 2015 +0000
- Revision:
- 0:0d2f27f56dfa
Blink example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WilcoBonestroo | 0:0d2f27f56dfa | 1 | #include "mbed.h" |
WilcoBonestroo | 0:0d2f27f56dfa | 2 | |
WilcoBonestroo | 0:0d2f27f56dfa | 3 | DigitalOut myled(LED1); |
WilcoBonestroo | 0:0d2f27f56dfa | 4 | |
WilcoBonestroo | 0:0d2f27f56dfa | 5 | int main() { |
WilcoBonestroo | 0:0d2f27f56dfa | 6 | while(1) { |
WilcoBonestroo | 0:0d2f27f56dfa | 7 | for (uint8_t i=0; i < 50; i++) |
WilcoBonestroo | 0:0d2f27f56dfa | 8 | { |
WilcoBonestroo | 0:0d2f27f56dfa | 9 | myled = 1; // LED is ON |
WilcoBonestroo | 0:0d2f27f56dfa | 10 | wait(0.05); // 200 ms |
WilcoBonestroo | 0:0d2f27f56dfa | 11 | myled = 0; // LED is OFF |
WilcoBonestroo | 0:0d2f27f56dfa | 12 | wait(0.05); |
WilcoBonestroo | 0:0d2f27f56dfa | 13 | |
WilcoBonestroo | 0:0d2f27f56dfa | 14 | } |
WilcoBonestroo | 0:0d2f27f56dfa | 15 | wait(5.0); // 5 sec |
WilcoBonestroo | 0:0d2f27f56dfa | 16 | } |
WilcoBonestroo | 0:0d2f27f56dfa | 17 | } |