Step 4.6 of Tutorial

Dependencies:   DMBasicGUI DMSupport

Fork of lpc4088_displaymodule_hello_world by Embedded Artists

Files at this revision

API Documentation at this revision

Comitter:
millsrm0724
Date:
Tue Jun 14 20:48:05 2016 +0000
Parent:
5:aa78408d4e5a
Commit message:
Added Step 4.6 of tutorial

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 28 12:00:49 2015 +0000
+++ b/main.cpp	Tue Jun 14 20:48:05 2016 +0000
@@ -3,6 +3,11 @@
 #include "lpc_swim.h"
 #include "lpc_swim_font.h"
 
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
 int main()
 {
   DMBoard::BoardError err;
@@ -10,6 +15,12 @@
   RtosLog* log = board->logger();
   Display* disp = board->display();
   
+    //Turn all LEDs off
+    myled1 = 1;  //LED1 is active low, turn it off
+    myled2 = 1;  //LED2 is active low, turn it off
+    myled3 = 0;  //LED3 is active high, turn it off
+    myled4 = 0;  //LED4 is active high, turn it off
+  
   do {
     err = board->init();
     if (err != DMBoard::Ok) {
@@ -53,6 +64,19 @@
     mbed_die();
   }  
 
-  while(true) {
+  while(true) 
+  {
+        myled3 = 0;  //Turn LED3 off
+        myled1 = 0;  //Turn LED1 on
+        wait(0.2);   //Wait 200 ms
+        myled1 = 1;  //Turn LED1 off
+        myled2 = 0;  //Turn LED2 on
+        wait(0.2);   //Wait 200 ms
+        myled2 = 1;  //Turn LED2 off
+        myled4 = 1;  //Turn LED4 on
+        wait(0.2);   //Wait 200 ms
+        myled4 = 0;  //Turn LED4 off
+        myled3 = 1;  //Turn LED3 on
+        wait(0.2);   //Wait 200 ms
   }   
 }