part 2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kevinmark13
Date:
Wed Dec 03 01:00:31 2014 +0000
Commit message:
Lab 1 Part 2;

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	Wed Dec 03 01:00:31 2014 +0000
@@ -0,0 +1,63 @@
+// Kevin_maddox__Lab1Part2.cpp : Defines the entry point for the console application.
+
+/***********************************************************************************************
+CREATED BY: KEVIN MADDOX
+DATE: 2 DEC 2014
+
+SUMMARY:
+Our goal is to have 4 LEDs flash 5 times in turn (i.e., LED1 flashes 10 times, followed by LED2, 
+then followed by LED3, and finally followed by LED4, and it repeats). Design the hardware 
+connection of your LEDs to mbed. Build your circuit and include all the required 
+information about your hardware design in your lab report.
+
+***************************************************************************************************/
+
+#include "mbed.h" //calling the mbed.h library
+ 
+// creating the digital out objects for each pin out
+DigitalOut myLed01(p5);
+DigitalOut myLed02(p10);
+DigitalOut myLed03(p15);
+DigitalOut myLed04(p20);
+ 
+int main()
+{
+  
+    char i = 0; //init i to zero
+ 
+        
+        while (1){ //endless while lopp
+        
+        for (i = 0; i < 10; i++) { //start conditional loop led 1
+            myLed01 = 1;
+            wait(0.2);
+            myLed01 = 0;
+            wait(0.2);    
+            i++;
+        }
+        for (i = 0; i < 10; i++) {//start conditional loop led 2
+            myLed02 = 1;
+            wait(0.2);
+            myLed02 = 0;
+            wait(0.2);    
+            i++;
+            
+        }
+         for (i = 0; i < 10; i++) { //start conditional loop led 3
+            myLed03 = 1;
+            wait(0.2);
+            myLed03 = 0;
+            wait(0.2);    
+            i++;
+        }
+          for (i = 0; i < 10; i++) { //start conditional loop led 4
+            myLed04 = 1;
+            wait(0.2);
+            myLed04 = 0;
+            wait(0.2);    
+            i++;
+        } 
+     
+    } // closing for endless while
+
+} // closing for program
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Dec 03 01:00:31 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file