Serpentine / Mbed 2 deprecated serpentine_snakecontroller_final

Dependencies:   MMA8451Q TSI mbed

Fork of snakecontroller by Serpentine

Revision:
9:7628a5b8b6f2
Parent:
8:93190b81ceca
--- a/main.cpp	Thu Jun 09 18:25:29 2016 +0000
+++ b/main.cpp	Thu Jun 09 18:36:04 2016 +0000
@@ -75,9 +75,9 @@
         {
             if(forward == true)
             {
-                Direction = 0;                 //Direction variable is a two bit number 0-3 0 is forward
+                Direction = 0;                  //Direction variable is a two bit number 0-3 0 is forward
                 
-                lefthigh = 0;                   //Light up the forward LED, make sure all others are of
+                lefthigh = 0;                   //Light up the forward LED, make sure all others are off
                 leftlow = 0;
                 righthigh = 0;
                 rightlow = 0;
@@ -89,9 +89,9 @@
             }//endif
             else
             {
-                Direction = 2;
+                Direction = 2;                  //Direction variable is a two bit number 0-3 2 is backward
                 
-                lefthigh = 0;
+                lefthigh = 0;                   //Light up the backward LED, make sure all others are off
                 leftlow = 0;
                 righthigh = 0;
                 rightlow = 0;
@@ -106,9 +106,9 @@
         {
             if(right == true)
             {
-                Direction = 1;
+                Direction = 1;                  //Direction variable is a two bit number 0-3 1 is right
                 
-                lefthigh = 0;
+                lefthigh = 0;                   //Light up the right LED, make sure all others are off
                 leftlow = 0;
                 righthigh = 1;
                 rightlow = 0;
@@ -120,9 +120,9 @@
             }//endif
             else
             {
-                Direction = 3;
+                Direction = 3;                  //Direction variable is a two bit number 0-3 3 is left
                 
-                lefthigh = 1;
+                lefthigh = 1;                   //Light up the left LED, make sure all others are off
                 leftlow = 0;
                 righthigh = 0;
                 rightlow = 0;
@@ -134,7 +134,7 @@
             }//endelse
         }//endelse
         
-        printf("Direction = %d \r\n", Direction);          //Print the value of Direction to the serial         
+        printf("Direction = %d \r\n", Direction);          //Print the value of Direction to the serial for debugging       
         
     }//endwhile
 }//endmain