Final Revision

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
m182376
Date:
Tue Sep 29 13:49:02 2015 +0000
Parent:
0:fc1503207544
Commit message:
Final Revision

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Sep 28 23:07:43 2015 +0000
+++ b/main.cpp	Tue Sep 29 13:49:02 2015 +0000
@@ -1,3 +1,7 @@
+// Lab 1 Program B
+// Program Allow the user to do different functions with the LED lights using the Logic Switches 1 and 2.
+// Written by: MIDN 3/C Hague 9/28/15
+
 #include "mbed.h"
 
 DigitalIn LS1(p16);// Switch 1
@@ -10,11 +14,11 @@
 int main()
 {
 
-    int number1, number2;
+    int number1, number2;// used for rand functions later
 
     while(1) { //Continuous While Loop
 
-        if ((LS1 == 0 && LS2 == 0) || (LS1 == 1 && LS2 == 0) || (LS1 == 0 && LS2 == 1)) {
+        if ((LS1 == 0 && LS2 == 0) || (LS1 == 1 && LS2 == 0) || (LS1 == 0 && LS2 == 1)) {// Huge if statement so that I can use BusOut and DigitalOut in the next if
 
             BusOut lights(p26, p27, p28, p29, p30); // Date bus for LEDs
 
@@ -72,14 +76,14 @@
             }
         }
         
-        number1 = rand()%5;
-        number2 = rand()%5;
+        number1 = rand()%5;// Used for two random LEDs
+        number2 = rand()%5;// Used for two random LEDs
 
-        if (LS1 == 1 && LS2 == 1) {
+        if (LS1 == 1 && LS2 == 1) {// second if statement different use of communicating to LEDs
             
-            DigitalOut D_lights[5]={p26, p27, p28, p29, p30};
+            DigitalOut D_lights[5]={p26, p27, p28, p29, p30}; //DigitalOut to use pins with array
             
-            if((number1 != number2) ) {
+            if((number1 != number2) ) { // If both of the numbers do not equal eachother therefore there is always two leds lit
                 
                 D_lights[number1]=1;
                 D_lights[number2]=1;