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: BMP180 N5110 PowerControl mbed
Diff: main.cpp
- Revision:
- 8:29ac7d274ae0
- Parent:
- 7:104ac8e707e6
- Child:
- 9:693f69e0a175
--- a/main.cpp Sun Apr 19 17:53:39 2015 +0000
+++ b/main.cpp Sun Apr 19 20:02:08 2015 +0000
@@ -451,6 +451,43 @@
lcd.refresh();
}
+void displayMeasurementTitle(){
+ // origin x,y,width,height,type
+ lcd.drawRect(0,0,83,6,0); // transparent, just outline
+ lcd.drawCircle(10,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(14,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(18,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(22,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(26,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(30,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(34,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(38,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(34,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(46,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(50,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(54,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(58,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(62,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(66,3,2,0); // x,y,radius,transparent with outline
+ lcd.drawCircle(70,3,2,1); // x,y,radius,black fill
+ lcd.drawCircle(74,3,2,0); // x,y,radius,transparent with outline
+
+ // x0,y0,x1,y1,type 0-white,1-black,2-dotted
+ lcd.drawLine(0,0,6,6,1);
+ lcd.drawLine(0,6,6,0,1);
+ /*
+ * *
+ * *
+ * *
+ * Black line with intercept; (3,3).
+ * *
+ * *
+ * *
+ */
+ lcd.drawLine(77,0,83,6,1);
+ lcd.drawLine(77,6,83,0,1);
+}
+
//1 bar is 100000 Pa. An atm is 101325 Pa. Therefore an mb is 100 Pa.
int main()
@@ -495,6 +532,7 @@
if(dispTimerFlag) {
//read values (T in degrees Celsius and P in mb).
+ displayMeasurementTitle();
measurement = bmp180.readValues();
temp = measurement.temperature;
press = measurement.pressure;
@@ -507,6 +545,7 @@
printReadings();
lcd.refresh();
+
}
if(menuButtonFlag == 1){ //if menu button has been pressed once
@@ -667,6 +706,8 @@
@param altitude - altitude calculated from the pressure reading (m).
*/
+float prevPress;
+
void printReadings()
{
char buffer[14]; // each character is 6 pixels wide, screen is 84 pixels (84/6 = 14)
@@ -750,16 +791,18 @@
}
} //close unit setting 2
-
- if (press++) {
+ if (press > prevPress) {
lcd.printString("Hotter Weather",2,4); //column 2, row 4.
lcd.printString("On the Way!",2,5); //column 2 , row 5.
}
- else if (press--) {
- lcd.printString("The temperature",2,4); //column 2, row 4.
- lcd.printString("is predicted",2,5); //column 2 , row 5.
- lcd.printString("to fall!",2,6); //column 2, row 4.
+ else if (press < prevPress) {
+ lcd.printString("Temp's predic-",0,4); //column 2, row 4.
+ lcd.printString("ted to fall!",0,5); //column 2 , row 5.
}
+ else{
+
+ }
+ prevPress = press; //set the "previous pressure" to be the pressure read, so that it can be used the next time the function runs.
}
void clearCells()