Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:2abf3e443afa, committed 2021-03-08
- Comitter:
- malyuskin
- Date:
- Mon Mar 08 13:47:55 2021 +0000
- Parent:
- 0:a8a8e4580a01
- Commit message:
- blinking two LEDs on Nucleo L432KC
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Mar 07 21:22:52 2021 +0000 +++ b/main.cpp Mon Mar 08 13:47:55 2021 +0000 @@ -1,12 +1,25 @@ + +// blinking multiple LEDs with the same blinking rate +//two LEDs are connected to pins D10 and D12 + #include "mbed.h" -DigitalOut myled(D12); +DigitalOut myled1(D10); //output digital pin D10 +DigitalOut myled2(D12); //output digital pin D10 + int main() { +double blinkRate = 0.5; //blink rate 500ms + while(1) { - myled = 1; // LED is ON - wait(0.2); // 200 ms - myled = 0; // LED is OFF - wait(1.0); // 1 sec + myled1 = 0; // LED1 is OFF + myled2 = 1; // LED1 is ON + + wait(blinkRate); // + + myled1 = 1; // LED2 is ON + myled2 = 0; // LED2 is OFF + + wait(blinkRate); // } }