ESE519 / Mbed 2 deprecated Part0_version2

Dependencies:   mbed

Revision:
1:dbcb74ecd5b0
Parent:
0:de7d01936df5
Child:
2:bfe32024e001
--- a/main.cpp	Thu Jan 29 18:22:32 2015 +0000
+++ b/main.cpp	Fri Feb 06 02:45:29 2015 +0000
@@ -1,8 +1,10 @@
 #include "mbed.h"
 #include "math.h"
 
+//Establish Serial Interface
 Serial pc(USBTX, USBRX);
 
+//Define System Inputs and Ouputs
 DigitalOut myled1(LED1);
 DigitalOut myled2(LED2);
 DigitalOut myled3(LED3);
@@ -10,7 +12,10 @@
 
 
 int main() {
+        
+        //Initialze randomness
         srand(time(NULL));
+        //Define the random sequence of leds length 10
         int a = (rand()%3);
         int b = (rand()%3);
         int c = (rand()%3);
@@ -20,19 +25,18 @@
         int g = (rand()%3);
         int h = (rand()%3);
         int i = (rand()%3);
-        int i = (rand()%3);
         int j = (rand()%3);
-
-        
         int pattern[10] = {a,b,c,d,e,f,g,h,i,j};
         
-        
+        //Debug purposes
         pc.printf("A: %f, %f, %f",a,b,c);
 
     while(1) {
         
         timer.start();
+        //ensure only loop once
         while(timer.read() < 18){
+            //Loop through pattern 
             for(int i = 0; i < 10; i+= 1){
                 switch(pattern[i])
                     {
@@ -52,11 +56,10 @@
                         myled3 = 0;
                         break;
                     }
- 
                 }
            }
            
-        timer.reset();
+        timer.reset();        //reset timer
 
         }
 }
\ No newline at end of file