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.
Dependencies: BSP_B-L475E-IOT01
Diff: main.cpp
- Revision:
- 5:2d1980c7ca2d
- Parent:
- 0:280450d2b3cc
- Child:
- 6:ff641476ffe3
--- a/main.cpp Fri Apr 14 13:42:52 2017 +0200
+++ b/main.cpp Fri Apr 14 14:35:49 2017 +0200
@@ -1,11 +1,42 @@
#include "mbed.h"
DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+// This object drives both LD3 and LD4 on the board.
+// Only one of these LEDs can be driven at a time.
+DigitalInOut led3(LED3);
+
+#define LD1_ON {led1 = 1;}
+#define LD1_OFF {led1 = 0;}
+#define LD2_ON {led2 = 1;}
+#define LD2_OFF {led2 = 0;}
+#define LD3_ON {led3.output(); led3 = 1;}
+#define LD3LD4_OFF {led3.input();}
+#define LD4_ON {led3.output(); led3 = 0;}
+
+// Select your demo
+#define DEMO1_LEDS
int main()
{
+#ifdef DEMO1_LEDS
while(1) {
- led1 = !led1;
- wait(1);
+ LD1_ON;
+ wait(0.5);
+ LD2_ON;
+ wait(0.5);
+ LD3_ON;
+ wait(0.5);
+ LD4_ON;
+ wait(0.5);
+ LD1_OFF;
+ wait(0.5);
+ LD2_OFF;
+ wait(0.5);
+ LD3LD4_OFF;
+ wait(0.5);
+ }
+#endif
+ while(1) {
}
}