Nestor Rueda / Mbed 2 deprecated Parking-RadarSRF02

Dependencies:   N5110 PowerControl SRF02 beep mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Button.cpp Source File

Button.cpp

Go to the documentation of this file.
00001 /**
00002 @file Button.cpp
00003 @brief main file for the Ultrasound Distance Sensor Project.
00004 @brief Has three main functions; parking distance guide, ultrasound radar and settings.
00005 @brief Revision 3.6.
00006 @author Nestor Isaac Garcia Rueda (200798965)
00007 @date 02/May/2015
00008 */
00009 
00010 /*Here, we are including the following libraries and its respectively codes*/
00011 #include "mbed.h"                                     /*Importing the mbed.h library header file of the mbed NXP LPC 1768 Microcontroller*/
00012 #include "N5110.h"                                   /*Importing the N5110.h library header file of the Nokia 5110 LCD screen*/
00013 #include "SRF02.h"                                  /*Importing the SRF02.h library header file of the SRF02 ultrasound device*/
00014 #include "beep.h"                                  /*Importing beep.h library header file of the beep library*/   
00015 #include "PowerControl/PowerControl.h"            /*Importing the PowerControl/PowerControl.h library header file of the PowerControl library*/
00016 #include "PowerControl/EthernetPowerControl.h"   /*Importing the PowerControl/EthernetPowerControl.h library header file of the PowerControl library*/
00017 
00018 AnalogIn pot(p20);                             /*Declaring name space (pot) and pin number (p20) of the potentiometer*/
00019 Beep buzzer(p21);                               /*Declaring name space (buzzer) and pin number (p21) of the buzzer speaker*/
00020 InterruptIn button(p18);                         /*Declaring name space (button) and pin number (p18) of the interrupt button*/
00021 BusOut inLeds(LED3,LED4);                         /*Declaring name space (inLeds) and inner embedded LEDs of mbed NXP LPC 1768 Microcontroller*/
00022 
00023 //Serial serial(USBTX,USBRX);                        /*Declaration of serial interface for CoolTerm debugging with usb transmitter and receiver defintitions*/
00024 
00025 BusOut pcbLEDS (p25,p24,p23,p22);                      /*Declaring name space (pcbLEDS) and its corresponding pin numbers (p25,p24,p23,p22) of the LEDs of the PCB*/
00026 N5110 lcd(p7,p8,p9,p10,p11,p13,p26);                  /*Declaring name space (lcd) and corresponding pin numbers (p7,p8,p9,p10,p11,p13,p26) of the Nokia 5110 LCD screen*/
00027 SRF02 srf02(p28,p27);                                /*Declaring SDA and SCL pins (p28,p27)*/
00028 
00029 Ticker onBoardLedTimer;                           /*Ticker object for blinking on board LED*/
00030 Ticker refLed;                                  /*Ticker object to eliminate the need for wait() function for the on-PCB status LED's*/
00031 Ticker clearTimer;
00032 
00033 int c = 1;                                        /*Float is 0.something and 'int' represents whole numbers, where we are declaring 'c' to be a whole number and to have a value of 1*/
00034 void ledFlow()                                   /*Void function for executing the brightness backlight pre-intro presentation*/
00035 {
00036     pcbLEDS = 8;                               /*The named space previously defined, lights on, in this case 2^3= 8 in binary, therefore it only will the fourth led*/
00037     wait_ms(200);                              /*Waiting time delay of 0.2 seconds*/
00038     pcbLEDS = 12;                              /*Lights on, in this case 2^3+2^2= 12 in binary, therefore it will only the third and fourth led*/
00039     wait_ms(200);                              /*Delay of 0.2 seconds*/
00040     pcbLEDS = 14;                              /*Lights on, in this case 2^3+2^2+2^1= 14 in binary, therefore it will only the second, third and fourth led*/
00041     wait_ms(200);                              /*Delay of 0.2 seconds*/
00042     pcbLEDS = 15;                              /*Lights on, in this case 2^3+2^2+2^1+2^0= 15 in binary, therefore it will all the four leds*/
00043     wait_ms(200);                              /*Delay of 0.2 seconds*/
00044     pcbLEDS = 0;                               /*Lights off all leds*/
00045     
00046 }
00047 
00048 float d = 1;            /* Float is 0.smth and int whole*/
00049 void ledLaserA()         /* Void function named ledLaserA for executing the code below to be able to be called and run, executing the different led states*/
00050 {
00051     pcbLEDS = 1;         /*The named space previously defined, lights on, in this case 2^0= 1 in binary, therefore it only will the first led*/
00052     wait_ms(110);        /*Delay of 0.11 seconds*/
00053     pcbLEDS = 3;;        /*Lights on, in this case 2^1+2^0= 3 in binary, therefore it only will the first and second leds*/
00054     wait_ms(90);         /*Delay of 0.09 seconds*/
00055     pcbLEDS = 7;;        /*Lights on, in this case 2^2+2^1+2^0= 7 in binary, therefore it only will the first, second and third leds*/
00056     wait_ms(90);         /*Delay of 0.09 seconds*/
00057     pcbLEDS = 15;        /*Lights on, in this case 2^3+2^2+2^1+2^0= 15 in binary, therefore it will then the first, second, third and fourth leds*/
00058     wait_ms(90);         /*Delay of 0.09 seconds*/                 
00059 }
00060 void ledLaserB()         /*void function for ledLaserB led flashing states*/
00061 {
00062     pcbLEDS = 8;         /*The named space previously defined, lights on, in this case 2^3= 8 in binary, therefore it only will the fourth led*/
00063     wait_ms(110);        /*Delay of 0.11 seconds*/
00064     pcbLEDS = 12;        /*Lights on, in this case 2^3+2^2= 12 in binary, therefore it will only the third and fourth led*/
00065     wait_ms(90);         /*Delay of 0.09 seconds*/
00066     pcbLEDS = 14;        /*Lights on, in this case 2^3+2^2+2^1= 14 in binary, therefore it will only the second, third and fourth led*/
00067     wait_ms(90);         /*Delay of 0.09 seconds*/
00068     pcbLEDS = 15;        /*Lights on, in this case 2^3+2^2+2^1+2^0= 15 in binary, therefore it will all the four leds*/
00069     wait_ms(90);         /*Delay of 0.09 seconds*/
00070     pcbLEDS = 0;         /*Lights off all leds*/
00071 }
00072 
00073 int buttonFlag = 0;              /*between variable = 0 and variableReading = 0.3*/
00074 int buttonAltFlag = 0;            /*Alternate flag between variable = 0.3 and variableReading = 0.6*/
00075 int buttonSecondAltFlag = 0;        /*Second Alternate flag beyond variable = 0*/
00076 
00077 float variableReading = pot.read();      /*fetches potentiometer reading between 0 and 1 and stores it in a variable, potReading*/
00078 
00079 void action() //Interrupt Service Routine for Button
00080 {
00081     if(variableReading <= 0.3) { //less than this pot ratio
00082         buttonFlag = !buttonFlag; //if flag = 0 set it to 1; otherwise reset it to 0.
00083     }
00084 
00085     else if(variableReading > 0.3 & variableReading < 0.6) { //if otherwise pot reading between this pot ratio range - radar
00086         buttonAltFlag = !buttonAltFlag; //if flag = 0 set it to 1; otherwise reset it to 0.
00087     }
00088 
00089     else if(variableReading >= 0.6) { //or else this pot ratio is exceeded
00090         //lcd.setBrightness(pot.read());
00091         buttonSecondAltFlag = !buttonSecondAltFlag;
00092         // lcd.setBrightness(pot.read());
00093 
00094     }
00095 
00096     if ( variableReading < 0.6 && buttonSecondAltFlag == 1) {
00097         buttonSecondAltFlag = !buttonSecondAltFlag;
00098         //  lcd.setBrightness(pot.read());
00099     }
00100 
00101 }
00102 
00103 int LedFlag = 0; //flag set to change on-board LED state
00104 
00105 void LedTimerSet()  //Interrupt Service Routine for LedTimer
00106 {
00107     LedFlag = 1;  //set flag when timer expires.
00108 }
00109 
00110 int refLedFlag = 0;
00111 
00112 void refLedFlipped()
00113 {
00114     refLedFlag = 1;
00115 }
00116 
00117 int clearFlag = 0;
00118 
00119 void clearTimeout()
00120 {
00121     clearFlag = 1;
00122 }
00123 
00124 bool state;
00125 
00126 float a= 0.0;                    /*Floating data integer type constant defined as "a" and given the value of 0.0*/
00127 int counter = 0;                  /*Integer r set as an integer of 0*/
00128 void increaseBrightness()         /*void function for executing the brightness backlight pre-intro presentation*/
00129 {
00130     a+=0.2;                       /*increases by 0.2 the 'a' constant*/
00131     lcd.setBrightness(a);         /*the lcd brightness is been set, with the pre-set and defined constant ''a'', as the initial value state*/
00132     wait_ms(150);                 /*Delay of 0.15 seconds*/
00133 }
00134 
00135 void preIntro ()             /*void function for preIntro that performs the counting, increment and reset of the constant "a" state depending on its floating value, taking into account the task of counting floating numbers*/
00136 {
00137 
00138     while(counter < 2) {          /*A while loop that when the counter reaches 2, stops executing*/
00139 
00140 
00141         increaseBrightness();      /*calls the function*/
00142         if (a>0.4 && a<0.7) {
00143             lcd.inverseMode();    /*White and black pixels get inversed*/
00144         }
00145 
00146         else if (a>=1)  {         /*so i} the constant 'a' gets higher or equal to 1, after increasing by 0.2 every time, will execute the code line below*/
00147             a = 0;
00148             counter++;    /*sets the constant 'a' value to 0 and adds 1 to the counter when the if statement is met*/
00149 
00150         } else  {                /*Else statement*/
00151             lcd.normalMode();     /*Calls the member function normal mode running the code*/
00152         }
00153     }
00154 }
00155 
00156 void superIntro()
00157 {
00158     
00159 //LCD DISPLAY
00160 
00161     ledFlow();                                /*calls the ledFlow function been declared above*/
00162     lcd.clear();                              /*Clears screen by running the member function clear of the class lcd*/
00163     lcd.refresh();                            /*Refreshes screen by runnig member function*/
00164     pcbLEDS = 0;                              /*Lights off all leds*/
00165     lcd.printString("Electronic",15,0);         /*Calls the member function printString running the code and allowing us to print what's between quotation marks and the coordinates Y,X axis of 15 and 0*/
00166     lcd.printString("&",40,1);                  /*Prints on the lcd screen only the symbol "&" between quotation marks on the 40,1 Y,X axis coordinates*/
00167     lcd.printString("Electrical",6,2);          /*Prints "Electrical" on the 6,2 X,Y axis coordinates of the LCD*/
00168     lcd.printString("Engineer",37,3);           /*Prints "Engineer" on the 37,3 X,Y axis coordinates of the LCD*/
00169     lcd.printString("PRESENTS",5,4);            /*Prints "PRESENTS" on the 5,4 X,Y axis coordinates of the LCD*/
00170     lcd.printString("///*///*///*//",0,5);      /*Prints "///*///*///*//" on the 0,5 X,Y axis coordinates of the LCD*/
00171     wait(2);                                  /*Delay of 2 secs*/
00172 
00173 
00174     ledFlow();                             /*calls the ledFlow function been declared above*/
00175     lcd.clear();                              /*Clears screen by running the member function clear of the class lcd*/
00176     lcd.printString("///*///*///*//",0,0);      /*Prints "///*///*///*//" on the 0,0 X,Y axis coordinates of the LCD*/
00177     lcd.printString("The",34,1);                /*Prints "The" on the 34,1 X,Y axis coordinates of the LCD*/
00178     lcd.printString("SRF",34,2);                /*Prints "SRF" on the 34,2 X,Y axis coordinates of the LCD*/
00179     lcd.printString("Ultrasound",13,3);         /*Prints "Ultrasound" on the 13,3 X,Y axis coordinates of the LCD*/
00180     lcd.printString("Project",21,4);            /*Prints "Project" on the 21,4 X,Y axis coordinates of the LCD*/
00181     lcd.printString("///*///*///*//",0,5);      /*Prints "///*///*///*//" on the 0,5 X,Y axis coordinates of the LCD*/
00182     lcd.inverseMode();                        /*calls the function from the N5110.h library and runs the function inverseMode to inverse the B&W pixel states*/
00183     wait(2);                       /*waiting time of 2secs*/
00184 
00185     ledFlow();                      /*calls the ledFlow function been declared above*/
00186     lcd.clear();                           /*clears screen*/
00187     lcd.printString("///*///*///*//",0,0);      /*Prints "///*///*///*//" on the 0,0 X,Y axis coordinates of the LCD*/
00188     lcd.printString("Designed",15,1);           /*Prints "Designed" on the 15,1 X,Y axis coordinates of the LCD*/
00189     lcd.printString("By",34,2);                 /*Prints "By" on the 34,2 X,Y axis coordinates of the LCD*/
00190     lcd.printString("Nestor Isaac",7,3);        /*Prints "Nestor Isaac" on the 7,3 X,Y axis coordinates of the LCD*/
00191     lcd.printString("Garcia Rueda",7,4);        /*Prints "Garcia Rueda" on the 7,4 X,Y axis coordinates of the LCD*/
00192     lcd.printString("///*///*///*//",0,5);      /*Prints "///*///*///*//" on the 0,5 X,Y axis coordinates of the LCD*/
00193     lcd.normalMode();                       /*calls the function from the N5110.h library and runs the function normalMode to normal the B&W pixel states*/
00194     wait(3);                         /*waiting time of 3secs*/
00195     pcbLEDS=15;                      /*Lights on, in this case 2^3+2^2+2^1+2^0= 15 in binary, therefore it will all the four leds*/
00196     lcd.refresh();                      /*refreshes screen by running the corresponding member function*/
00197     lcd.clear();                      /*clears screen by running the corresponding member function inside the lcd class*/
00198 }
00199 
00200 int main ()                   /*Starts the main function where "int" represents the data type of the return value from the pgoramme where if returned a 0, means that its worked ok and if returned 1, would mean that something went wrong*/ 
00201 {                              /*Curly bracket that reresets the openning/begining of the main function*/
00202     PHY_PowerDown();            /*Ethernet Power-Down, saves up around 175mW*/
00203     lcd.init();                 /*Initialises screen by running the member function init of the class lcd*/
00204     preIntro();                 /*Calls the defined void function "preIntro" declared above*/ 
00205     superIntro();               /*Calls the defined void function "preIntro" declared above*/
00206     button.rise(&action);
00207 
00208     onBoardLedTimer.attach(&LedTimerSet,1.0);      /*call ISR every second second*/
00209 
00210     refLed.attach(&refLedFlipped,0.3);             /*call ISR once after 0.3 seconds elapse*/
00211   
00212     clearTimer.attach(&clearTimeout,0.25);         /* calls ISR every quarter of a second*/
00213 
00214     while(1) {                                     /*Initialises a while loop that loops reading code forever*/
00215 
00216         if(clearFlag) {                         /*If statement that only executing if the clearFlag statement is met and runs the inner statement of "if"*/
00217         
00218                 lcd.clear();                         /*clears screen by running the corresponding member function inside the lcd class*/
00219                 clearFlag = 0;                        /*Makes the clearFlag value to be set initially as 0*/
00220                 variableReading = pot.read();          /*Here, we are just saying that the declared floating declaration variableReading is equals to pot.read(), which reads the potentiometer resistance*/ 
00221                 /*serial.printf("variable reading is %d\n",state);*/      /*This code was additionally used as for debugging purposes using CoolTerm so we could print ht ereadings when connecting our mbed platform to the programme*/
00222                 lcd.drawRect(15,5,60,10,0);              /* filled black rectangle   Y,X,length, width,1=FILLIN/0=NON-FILLING*/
00223                 lcd.drawRect(15,20,60,10,0);             /* filled black rectangle   Y,X,length, width,1=FILLIN/0=NON-FILLING*/
00224                 lcd.drawRect(15,35,60,10,0);             /* filled black rectangle   Y,X,length, width,1=FILLIN/0=NON-FILLING*/
00225 
00226                 lcd.drawCircle(WIDTH/11,HEIGHT/5.2,5,0);        /*Here, it takes the declared WIDTH on the lcd library of 84 pixels(in this case divided by 11) on the x axis and HEIGHT of 48 pixels in the y axis (in this case divided by 5.2),with a radius of 5cm,and 0 fo an white empty circle and 1 for a black filled circle that prints on the lcd screen*/
00227                 lcd.drawCircle(WIDTH/11,HEIGHT/1.97,5,0);       /*It calls the member function "drawCircle" inside the lcd class, with a WIDTH of 84/11, a HEIGHT of 48/1.97, a radius of 5, and a empty filled circle (0)*/
00228                 lcd.drawCircle(WIDTH/11,HEIGHT/1.2,5,0);        /*It calls the member function "drawCircle" inside the lcd class, with a WIDTH of 84/11, a HEIGHT of 48/1.2, a radius of 5, and a empty filled circle (0)*/
00229 
00230                 lcd.printString("PARKING",23,1);             /*Prints "Electrical" on the 6,2 X,Y axis coordinates of the LCD*/
00231                 lcd.printString("RADAR",29,3);               /*Prints "Electrical" on the 6,2 X,Y axis coordinates of the LCD*/
00232                 lcd.printString("SETTINGS",20,5);            /*Prints "Electrical" on the 6,2 X,Y axis coordinates of the LCD*/
00233                 
00234 
00235 
00236                 if (variableReading <= 0.3) {                                                    /*This is for the PARKING option*/
00237                     lcd.drawCircle(WIDTH/11,HEIGHT/5.2,5,1);  // x,y,radius,black fill
00238                     ledLaserA();
00239                     lcd.refresh();
00240                     ledLaserB();
00241                     lcd.drawCircle(WIDTH/11,HEIGHT/5.2,5,1);  // x,y,radius,black fill
00242                     lcd.refresh();
00243 
00244                     while(buttonFlag == 1) {
00245                         lcd.clear();
00246                         //buzzer.beep(200,1.5);
00247                         inLeds = 1;
00248                         if(LedFlag) { //if flag has been set
00249                             inLeds = inLeds + 1;
00250                             if(inLeds < 3) {
00251                                 inLeds = 0;
00252                             }
00253                             LedFlag = 0;  //reset flag
00254                         }
00255                         int distReading = srf02.getDistanceCm();
00256 
00257                         lcd.clear();
00258 
00259                         char stringBuffer[14];
00260 
00261                         lcd.printString("Measured range",0,2);
00262 
00263                         sprintf(stringBuffer,":%dcm",distReading);
00264 
00265                         lcd.printString(stringBuffer,43,3);
00266                         lcd.refresh();
00267 
00268                         if (distReading >=12 && distReading <=15  ) {
00269                             pcbLEDS = 8;
00270                             lcd.printString("///*///*///*//",0,0);      //Y,X axis
00271                             lcd.printString("WELL DONE!",0,1);
00272                             lcd.printString("car parked at  ",0,2);
00273                             lcd.printString("///*///*///*//",0,4);      //Y,X axis
00274                             lcd.printString("///*///*///*//",0,5);      //Y,X axis
00275                             buzzer.beep(200,1.5);
00276                             wait(4);
00277                         }
00278                         if (distReading > 15 && distReading <= 30) {
00279                             pcbLEDS = 12;
00280                             lcd.printString("//////////////",0,0);      //Y,X axis
00281                             lcd.printString("wall at",0,3);
00282                             lcd.printString("Slow approach,",0,2);
00283                            // lcd.printString("recommended",0,4);
00284                             
00285                             wait_ms(300);
00286                         }
00287                         if (distReading > 30 && distReading <= 50) {
00288                             pcbLEDS = 14;
00289                             wait_ms(300);
00290                         }
00291                         if (distReading > 50 && distReading <= 50) {
00292                             pcbLEDS = 15;
00293                             wait_ms(300);
00294                         } else {
00295                             //pcbLEDS = 15;
00296 //                    wait_ms(300);
00297 //                    pcbLEDS = 0;
00298                             ledFlow();
00299                              lcd.refresh();
00300                         }
00301                         lcd.refresh();
00302 
00303                         //       if (distReading < 35) {
00304                         //  buzzer.beep(500,1.0);
00305 //                    pcbLEDS = 14;
00306 //                    wait_ms(300);
00307 //
00308 //                if (distReading < 25) {
00309 //                   buzzer.beep(1000,1.0);
00310 //                    pcbLEDS = 12;
00311 //                    wait_ms(300);
00312 //
00313 //                if (distReading < 15) {
00314 //                        buzzer.beep(9000,1.0);
00315 //                        pcbLEDS = 8;
00316 //                        wait_ms(300);
00317 //                    } //close dist reading 15
00318 //             lcd.refresh();
00319 //                } //close dist reading 35
00320 //            } //close button flag 1
00321 //        } //close variable reading 0.3 to 0.6
00322                         lcd.refresh();
00323                     }
00324                     lcd.clear();
00325 
00326                     lcd.refresh();
00327                 }
00328 
00329                 if (variableReading >0.3 && variableReading <0.6) {
00330                     //This is the RADAR option
00331                     lcd.drawCircle(WIDTH/11,HEIGHT/1.97,5,1);  // x,y,radius,black fill
00332                     ledLaserA();
00333                     lcd.refresh();
00334                     ledLaserB();
00335                     lcd.drawCircle(WIDTH/11,HEIGHT/1.97,5,1);  // x,y,radius,black fill
00336                     lcd.refresh();
00337 
00338                     while(buttonAltFlag == 1) {
00339                         lcd.clear();
00340                         //buzzer.beep(200,1.5);
00341                         inLeds = 1;
00342                         if(LedFlag) { //if flag has been set
00343                             inLeds = inLeds + 1;
00344                             if(inLeds < 3) {
00345                                 inLeds = 0;
00346                             }
00347                             LedFlag = 0;  //reset flag
00348                         }
00349                         int distReading = srf02.getDistanceCm();
00350 
00351                         lcd.clear();
00352 
00353                         char stringBuffer[14];
00354 
00355                         lcd.printString("Measured range",0,2);
00356 
00357                         sprintf(stringBuffer,": %d cm",distReading);
00358 
00359                         lcd.printString(stringBuffer,0,3);
00360                         lcd.refresh();
00361 
00362                         if (distReading <=15) {
00363                             pcbLEDS = 8;
00364                             wait_ms(300);
00365                         }
00366                         if (distReading > 15 && distReading <= 30) {
00367                             pcbLEDS = 12;
00368                             wait_ms(300);
00369                         }
00370                         if (distReading > 30 && distReading <= 50) {
00371                             pcbLEDS = 14;
00372                             wait_ms(300);
00373                         }
00374                         if (distReading > 50 && distReading <= 50) {
00375                             pcbLEDS = 15;
00376                             wait_ms(300);
00377                         } else {
00378                             //pcbLEDS = 15;
00379 //                    wait_ms(300);
00380 //                    pcbLEDS = 0;
00381                             ledFlow();
00382                         }
00383                         lcd.refresh();
00384 
00385                         //       if (distReading < 35) {
00386                         //  buzzer.beep(500,1.0);
00387 //                    pcbLEDS = 14;
00388 //                    wait_ms(300);
00389 //
00390 //                if (distReading < 25) {
00391 //                   buzzer.beep(1000,1.0);
00392 //                    pcbLEDS = 12;
00393 //                    wait_ms(300);
00394 //
00395 //                if (distReading < 15) {
00396 //                        buzzer.beep(9000,1.0);
00397 //                        pcbLEDS = 8;
00398 //                        wait_ms(300);
00399 //                    } //close dist reading 15
00400 //             lcd.refresh();
00401 //                } //close dist reading 35
00402 //            } //close button flag 1
00403 //        } //close variable reading 0.3 to 0.6
00404                         lcd.refresh();
00405                     }
00406                 }
00407 
00408                 if (variableReading >= 0.6) {
00409                     //This is the the SETTINGS option
00410                     lcd.drawCircle(WIDTH/11,HEIGHT/1.2,5,1);  // x,y,radius,black fill
00411                     if(refLedFlag == 1) {
00412                         ledLaserA();
00413                         lcd.refresh();
00414                         ledLaserB();
00415                         refLedFlag = 0;
00416                     }
00417                     lcd.refresh();
00418                     lcd.drawCircle(WIDTH/11,HEIGHT/1.2,5,1);  // x,y,radius,black fill
00419                     //lcd.printString("SETTINGS",20,5);           //X,Y axis
00420                     // buzzer.beep(12000,1.0);
00421                     while(buttonSecondAltFlag == 1) {
00422                         lcd.clear();
00423                         variableReading = pot.read();   // This, has to beinside the while loop as otherwise it would not bear it in mind when coding
00424                         lcd.setBrightness(variableReading);
00425                         char stringBuffer[14];
00426                         lcd.drawRect(15,6.5,60,10,0);  // filled empty rectangle   Y,X,length, width,1=FILLIN/0=NON-FILLING
00427                         lcd.drawCircle(WIDTH/11,HEIGHT/4.7,5,1);  // x,y,radius,transparent with outline
00428                         lcd.printString("LCD lumen",19,1);
00429                         //  buzzer.beep(200,1.5);
00430                         //lcd.printString("Measured range",0,3);
00431                         float tempVarReading = variableReading * 100;
00432                         sprintf(stringBuffer,": %.1f%%",tempVarReading);
00433                         lcd.printString(stringBuffer,0,4);
00434                         lcd.refresh();
00435                         //buzzer.beep(200,1.5);
00436                         //lcd.refresh();
00437                         wait(0.4);
00438 
00439                         //         // wait(0.5);
00440                     }  //close while buttonSecondAltFlag
00441                 }  //close if var reading greater than 0.6
00442             } //close while(1)
00443         }//close main
00444 
00445     //}
00446 }
00447