Level 2 Project Range Device
Dependencies: N5110 SDFileSystem SRF02 TMP102 mbed
Revision 14:204562d1fac8, committed 2016-05-05
- Comitter:
- el15pjt
- Date:
- Thu May 05 11:35:51 2016 +0000
- Parent:
- 13:8a8169370834
- Commit message:
- Final project submitting
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8a8169370834 -r 204562d1fac8 main.cpp --- 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();
diff -r 8a8169370834 -r 204562d1fac8 main.h --- a/main.h Thu May 05 11:19:35 2016 +0000 +++ b/main.h Thu May 05 11:35:51 2016 +0000 @@ -4,11 +4,19 @@ @brief Ranger Project @brief Revision 1.3. @author Philip Thompson -@date March 2016 +@date 05 May 2016 + @brief The following code has been writen for the University of Leeds ELEC264501 embedded system project and is intended to create a programe that can read a distance from an SRF02 sensor and then based aponn the reading disply the distance on the screen and increment the LEDs and buzzer according the provision of a temperature sensor is also provied as a secondary function when no object is detected with in range. + + + @brief The Libarys N5110, TMP102,SRF02 and have been imported from the mbed libary wizard from user Craig evans are are not of my + own work. + + + @breif The SRF02 libary has been edited by my self so as to include a function to read the distance from the imperial distance registers */ #ifndef MAIN_H