Sample LED blinky code using MAX32625 MBED board

Files at this revision

API Documentation at this revision

Comitter:
venkik
Date:
Thu Oct 12 08:59:22 2017 +0000
Parent:
0:917b0be9e567
Commit message:
Changed the code as per the suggestions of Mohamed

Changed in this revision

main_MAX32625.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main_MAX32625.cpp	Tue Oct 10 14:24:12 2017 +0000
+++ b/main_MAX32625.cpp	Thu Oct 12 08:59:22 2017 +0000
@@ -1,33 +1,43 @@
-#include "mbed.h"
+//Description:  This is a sample code that flashes the leds on the MAX32625 MBED board sequentially with a predefined delay  
 
-DigitalOut myled1(P3_3);
-DigitalOut myled2(P3_2);
-DigitalOut myled3(P3_1);
-DigitalOut myled4(P3_0);
+
+#include "mbed.h"  
 
 
+//The DigitalOut interface is used to configure and control a digital output pin.
+
+//Assigning the pin manes using the DigitalOut API 
+DigitalOut yLED(P3_3);
+DigitalOut bLED(P3_2);
+DigitalOut gLED(P3_1);
+DigitalOut rLED(P3_0);
+
+//  The main code starts here
 int main() {
-    while(1) {
-        myled1 = 1;
-        myled2 = 0;
-        myled3 = 0;
-        myled4 = 0;
+    while(1) //Initializing an infinite loop
+    {  
+        rLED = LED_ON;   //Using the predefined function LED_ON which turns ON the LED
+        gLED = LED_OFF;  //Using the predefined function LED_OFF which turns OFF the LED
+        bLED = LED_OFF;
+        yLED = LED_OFF;
+        wait(0.2);       // Wait is used to add some delay 
+        rLED = LED_OFF;
+        gLED = LED_ON;
+        bLED = LED_OFF;
+        yLED = LED_OFF;
         wait(0.2);
-        myled1 = 0;
-        myled2 = 1;
-        myled3 = 0;
-        myled4 = 0;
+        rLED = LED_OFF;
+        gLED = LED_OFF;
+        bLED = LED_ON;
+        yLED = LED_OFF;
         wait(0.2);
-        myled1 = 0;
-        myled2 = 0;
-        myled3 = 1;
-        myled4 = 0;
+        rLED = LED_OFF;
+        gLED = LED_OFF;
+        bLED = LED_OFF;
+        yLED = LED_ON;
         wait(0.2);
-        myled1 = 0;
-        myled2 = 0;
-        myled3 = 0;
-        myled4 = 1;
-        
         
     }
 }
+
+//End of the code
\ No newline at end of file