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 mbed
Diff: main.cpp
- Revision:
- 3:c9162dc9ba24
- Parent:
- 2:6b564e388747
- Child:
- 4:0302731434a5
--- a/main.cpp Thu Apr 30 15:35:35 2015 +0000
+++ b/main.cpp Thu Apr 30 16:25:48 2015 +0000
@@ -22,6 +22,9 @@
void clearCells();
+Timeout callT;
+Timeout callP;
+
Ticker timerT;
Ticker timerP;
@@ -35,12 +38,38 @@
timerPFlag = 1;
}
+void callTemp(){
+ Measurement measurement;
+ clearCells();
+ lcd.printString("Menu",0,5);
+ char bufferT[14];
+ measurement = bmp180.readValues();
+ int length=sprintf(bufferT,"T = %.2f C",measurement.temperature);
+ if (length<=14){
+ lcd.printString(bufferT,10,2);
+ }
+}
+
+void callPress(){
+ Measurement measurement;
+ clearCells();
+ lcd.printString("Menu",0,5);
+ char bufferP[14];
+ measurement = bmp180.readValues();
+ int length=sprintf(bufferP,"P = %.2f mb",measurement.pressure);
+ if (length<=14){
+ lcd.printString(bufferP,0,2);
+ }
+}
+
void readTemp(){
+ callT.attach(&callTemp,0.1);
while(1){
if (timerTFlag){
timerTFlag=0;
Measurement measurement;
clearCells();
+ lcd.printString("Menu",0,5);
char bufferT[14];
measurement = bmp180.readValues();
int length=sprintf(bufferT,"T = %.2f C",measurement.temperature);
@@ -52,11 +81,13 @@
}
void readPress(){
+ callP.attach(&callPress,0.1);
while(1){
if (timerPFlag){
timerPFlag=0;
Measurement measurement;
clearCells();
+ lcd.printString("Menu",0,5);
char bufferP[14];
measurement = bmp180.readValues();
int length=sprintf(bufferP,"P = %.2f mb",measurement.pressure);
@@ -77,6 +108,7 @@
void tempGraph(){
int j=0; //start graph on left hand side of screen
while(1){
+ lcd.printString("Menu",0,5);
if (timerTFlag){
timerTFlag=0;
clearCells();
@@ -93,6 +125,7 @@
void pressGraph(){
int j=0;
while(1){
+ lcd.printString("Menu",0,5);
if (timerPFlag){
timerPFlag=0;
clearCells();