Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BMP280
Revision 24:7bf408dc491a, committed 2018-01-10
- Comitter:
- mwthewsey
- Date:
- Wed Jan 10 03:16:57 2018 +0000
- Parent:
- 23:a6bb5298346c
- Child:
- 25:a2aedb498b27
- Commit message:
- Final Version. Self Test added.
Changed in this revision
--- a/LCD.cpp Wed Jan 10 02:36:50 2018 +0000
+++ b/LCD.cpp Wed Jan 10 03:16:57 2018 +0000
@@ -150,4 +150,11 @@
}
memset(_editingInTime, 0, 10*sizeof(char)); //Clear the variable name
return changingVal; //Return the new number.
-}
\ No newline at end of file
+}
+
+void ENVDISPLAY::POST(void)
+{
+ cls(); //Clear screen
+ printf("B1: %d\n",Button1.read()); //Display button 1 state
+ printf("B2: %d\n",Button2.read()); //Display button 2 state
+}
\ No newline at end of file
--- a/LCD.h Wed Jan 10 02:36:50 2018 +0000
+++ b/LCD.h Wed Jan 10 03:16:57 2018 +0000
@@ -71,6 +71,8 @@
//Display a custom message on the display with option to resume displaying readings
void Start(void);
//Inititates LCD activity
+ void POST(void);
+ //Self Test
void UpdateData(float temp, float pres, float LDR, time_t sampleTime);
//Pass in new enviromental data
--- a/main.cpp Wed Jan 10 02:36:50 2018 +0000
+++ b/main.cpp Wed Jan 10 03:16:57 2018 +0000
@@ -22,7 +22,10 @@
Serial PC(USBTX, USBRX);
//LCD card object. LCD pins and two timeset buttons
-ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14);
+ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14);
+
+//Forward Declaration of Self Test
+void POST(void);
int main()
{
@@ -31,7 +34,7 @@
logging = false;
//Hardware Self Test
-
+ POST();
//Initialise interrupts and times
SerialStart(); //Start serial comms
@@ -61,4 +64,37 @@
PC.printf("%s\n\r",char_array);
}
}
+}
+
+void POST(void)
+{
+ printf("------Self Test------\n\r");
+ lcd.POST();
+ printf("LCD Test Done\n\r");
+ printf("SDCard ejected?: %d\n\r",SD_WP.read());
+ printf("SDCard Dismount Button: %d\n\r",UserButton.read());
+ printf("Flashing SDCard Status LEDs\n\r");
+ int i;
+ for (i=0;i<5;i++){ //Flash the LEDs
+ GreenLED = 1;
+ SDCardStatusLED = 0;
+ Thread::wait(200);
+ GreenLED = 0;
+ SDCardStatusLED = 1;
+ Thread::wait(200);
+ }
+ SDCardStatusLED = 0;
+ printf("Temp: %5.1fC\n\r",sensor.getTemperature()); //Print temperature
+ printf("Pres: %5.1fmBar\n\r",sensor.getPressure()); //Print Pressure
+ printf("LDR: %f\n\r",LDRSensor); //Print Light Level
+ printf("Flashing Sample LED\n\r");
+ for (i=0;i<5;i++){ //Flash the LED
+ SamplingLED = 1;
+ Thread::wait(200);
+ SamplingLED = 0;
+ Thread::wait(200);
+ }
+ SamplingLED = 0;
+ printf("------Self Test Complete------\n\r");
+ Thread::wait(1000);
}
\ No newline at end of file