Uses the SRF02 UDS and displays distance in a variety of ways on the N5110 LCD.

Dependencies:   N5110WN PowerControl SRF02 mbed

Revision:
10:a32b1216d4ed
Parent:
9:163159830eaf
Child:
11:2b3d646e3bfb
--- a/main.cpp	Fri May 01 11:26:19 2015 +0000
+++ b/main.cpp	Fri May 08 08:51:12 2015 +0000
@@ -452,20 +452,18 @@
     if(J>39) {                                                  ///(as top 12 pixels are for time)
         J=39; /// limits the value so that it leaves space at the top for the distance
     }
-    array[D]= J; /// sets the latest plot into the array
+    array[83]= J; /// sets the latest plot into the array
     for (int i=0; i<84; i++) {  /// loops through the array
         lcd.setPixel(i,48 - array[i]); ///setting the plots. as 0,0 is top left so must be taken from 47
         for(int fill=47; fill>(48 - array[i]); fill--){
             lcd.setPixel(i,fill);// then filling the whole line from the plot to the bottom of the screen
         }
     }
-    if(D>=83){ D=83; /// if the position reaches 84 it loops round back to 0
+    
         for (int i=83; i>-1; i--) {  /// loops through the array
         PrevArray[i]= array[i];
         array[i]=PrevArray[i+1];
         }
-    }
-    else{D++;}/// increases the counter for the position in the array
     if(state==1) {
         sprintf(Dbuffer, "%.2f", distance*unitX);   /// prints the value to the serial port.
     } else if(state !=1) {