
Blink LEDs by using a PortOut object
Revision 0:e85a195c110f, committed 2021-09-21
- Comitter:
- cspista
- Date:
- Tue Sep 21 16:42:03 2021 +0000
- Commit message:
- MBED 2 project
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 21 16:42:03 2021 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" + +#define LED_MASK 0x00000038 //bits 3, 4, 5 +#define RED_MASK 0x00000008 //bit 3 (D3): LED_RED +#define GREEN_MASK 0x00000010 //bit 5 (D4): LED_GREEN +#define BLUE_MASK 0x00000020 //bit 4 (D5): LED_BLUE + +PortOut ledport(PortB, LED_MASK); + +int main() +{ + while(1) { + ledport = RED_MASK; + wait(0.5); + ledport = GREEN_MASK; + wait(0.5); + ledport = BLUE_MASK; + wait(0.5); + ledport = LED_MASK; + wait(0.5); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 21 16:42:03 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file