This program allows user to measure distance with SRF02 distance sensor and display the result on a Nokia LCD Display

Dependencies:   N5110 PowerControl SRF02 mbed

Revision:
4:880995b4a063
Parent:
3:012cdc8e0f75
Child:
5:c18bd289bc88
--- a/main.cpp	Sun Apr 26 19:41:25 2015 +0000
+++ b/main.cpp	Fri May 01 09:12:39 2015 +0000
@@ -20,21 +20,19 @@
     lcd.drawCircle(47,27,1,1);  // x,y,radius,black fill
     wait(1);
     lcd.clear(); // Clear all pixels off display
-
     serial.baud(9600); // set baud rate
     unit.rise(&uPressed); // call ISR on rising edge (button pressed)
     display.rise(&dPressed); // call ISR on rising edge (button pressed)
-    timer1.attach(&timer1Expired,2); // 2s timer
-    timer2.attach(&timer2Expired,1.5); // 1.5s timer
-    timer3.attach(&timer3Expired,1); // 1s timer
-    timer4.attach(&timer4Expired,0.5); // 0.5s timer
+    timer1.attach(&timer1Expired,1); // 2s timer
+    timer2.attach(&timer2Expired,0.8); // 1.5s timer
+    timer3.attach(&timer3Expired,0.6); // 1s timer
+    timer4.attach(&timer4Expired,0.3); // 0.5s timer
     timer5.attach(&timer5Expired,0.1); // 0.1s timer
     serial.attach(&serialISR); // attach serial ISR
     char buffer[30]; // buffer used to store information
     char buffer1[14]; // buffer used to store distance for LCD
     char buffer2[14]; // buffer used to store time for LCD
     char buffer3[14]; // buffer used to store month/date for LCD
-    set_time(0); // initialise time to 1st January 1970
     led1 = 1;
 
     while(1)  {
@@ -147,7 +145,7 @@
                         lcd.drawRect(1,1,64,48,1);  // filled black rectangle
                     }
                 }
-                serial.printf("Rate = 0.1\n");
+                serial.printf("Rate = 0.3\n");
                 warning();
             }
         } else if (distance<90) {
@@ -195,7 +193,7 @@
                         lcd.drawRect(1,1,44,48,1);  // filled black rectangle
                     }
                 }
-                serial.printf("Rate = 0.1\n");
+                serial.printf("Rate = 0.6\n");
                 warning();
             }
         } else if (distance<120) {
@@ -243,7 +241,7 @@
                         lcd.drawRect(1,1,24,48,1);  // filled black rectangle
                     }
                 }
-                serial.printf("Rate = 0.1\n");
+                serial.printf("Rate = 0.8\n");
                 warning();
             }
         } else {
@@ -291,7 +289,7 @@
                         lcd.drawRect(1,1,4,48,1);  // filled black rectangle
                     }
                 }
-                serial.printf("Rate = 0.1\n");
+                serial.printf("Rate = 1\n");
                 warning();
             }
         }