Level 2 Project Range Device
Dependencies: N5110 SDFileSystem SRF02 TMP102 mbed
Fork of Ranger by
Diff: main.cpp
- Revision:
- 12:0171e8723d9d
- Parent:
- 11:b64d123b9f4f
- Child:
- 14:204562d1fac8
--- a/main.cpp Thu May 05 10:51:19 2016 +0000 +++ b/main.cpp Thu May 05 11:12:50 2016 +0000 @@ -39,7 +39,7 @@ 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; @@ -77,11 +77,11 @@ /* 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 +89,12 @@ } 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 @@ -198,17 +198,17 @@ } else { sprintf(buffer2,"%0.2f In",avgdistance); } - lcd.printString(buffer2,25,2); + lcd.printString(buffer2,22,2); lcd.printString("****RANGE!****",0,0); - lcd.printString("DISTANCE",16,1); + lcd.printString("DISTANCE",18,1); lcd.printString("Menu",0,5); - int h; + float h; h = (r7*c)/84; ///Maps length of bar to largest set range r7 distbar = (avgdistance*h)-2; //drawRect(int x0,int y0,int width,int height,int fill); lcd.drawRect(0,29,distbar,7,1); // - //serial.printf("H = %i, r7 = %i",h,r7); - //serial.printf("distbar %f",distbar); +// serial.printf("H = %f, r7 = %i",h,r7); +// serial.printf("distbar %f",distbar); lcd.refresh(); } }//close function