Level 2 Project Range Device

Dependencies:   N5110 SDFileSystem SRF02 TMP102 mbed

Fork of Ranger by Philip Thompson

Revision:
14:204562d1fac8
Parent:
12:0171e8723d9d
--- a/main.cpp	Thu May 05 11:19:35 2016 +0000
+++ b/main.cpp	Thu May 05 11:35:51 2016 +0000
@@ -27,19 +27,19 @@
         serial.printf("Done.\n");
         fclose(fp);  // ensure you close the file after reading
     }
-    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 
-    //Startup Screen\\\\\\\\\\\\\\\\\\\\
+    //Startup Screen
+
     lcd.printString("ELEC 2645",0,0);
     lcd.printString("Project Ranger",0,1);
     lcd.printString("Phil Thompson",0,2);
     lcd.printString("SID 200971914 ",0,3);
     wait (3);
-    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+
 
     lcd.setBrightness(bright); //Set brightness of screen on startup from loaded value from SD Card
 
-    // Main while loop of the Ranger\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+    // Main while loop of the Ranger
     while(1) {
         if (g_sw1_flag) { /// Event triggered inturupt to call the menu and reset page numbers
             g_sw1_flag = 0;
@@ -60,8 +60,7 @@
         } // close if inteurrupt bracket
 
 
-//Function to average last 5 readings\\\\\\\\\\\\\\\\
-
+        //Function to average last 5 readings
         if (d == 4) {
             d = 0;
         } else {
@@ -74,14 +73,14 @@
         }
         avgdistance = (totaldistance/5);
 
-/*
-        Debugging\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+
+        /*Debugging\\
         Uncomment to use button 2 to toggle thru alert levels for debugging and comment out setalert();
-serial.printf("TOATAL DISTANCE %i\n", totaldistance);
-serial.printf("DISTANCE %i\n", distance);
-serial.printf("AVERAGE DISTANCE %f\n", avgdistance);
-serial.printf("ARRAY ELEMENT = %i\n", d);
-serial.printf("myarray %i\n", myarray[d]);
+        serial.printf("TOATAL DISTANCE %i\n", totaldistance);
+        serial.printf("DISTANCE %i\n", distance);
+        serial.printf("AVERAGE DISTANCE %f\n", avgdistance);
+        serial.printf("ARRAY ELEMENT = %i\n", d);
+        serial.printf("myarray %i\n", myarray[d]);
         if (g_sw2_flag) { /// Event triggered inturupt to call the menu and reset page numbers
             g_sw2_flag = 0;
             if (alert ==8) {
@@ -89,12 +88,13 @@
             } else {
                 alert++;
             }
-serial.printf("ALERT LEVEL %i\n", alert);
-        }
-*/
+            serial.printf("ALERT LEVEL %i\n", alert);
+        }*/
+
+
 
         setalert();
-//serial.printf("ALERT LEVEL %i\n", alert);
+        //serial.printf("ALERT LEVEL %i\n", alert);
         lcdoutput();
 
         if (alert !=0) { // no buzzer needed at alert == 0 path clear
@@ -132,7 +132,7 @@
     }
 }
 void lcdoutput()
-{   
+{
     // if alert == 0 no need to display range path is clear
     if (alert == 0) {
         lcd.clear();