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: LinearAnalogSensors mbed
Fork of mbed_measuring_temperature by
Revision 7:b0d12907493f, committed 2016-06-14
- Comitter:
- ekasinambela
- Date:
- Tue Jun 14 09:24:12 2016 +0000
- Parent:
- 6:9de0807e2855
- Child:
- 8:4b68520855f1
- Commit message:
- add LCD
Changed in this revision
| LinearAnalogSensors.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LinearAnalogSensors.lib Tue Jun 07 11:48:37 2016 +0000 +++ b/LinearAnalogSensors.lib Tue Jun 14 09:24:12 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/PennElectric/code/LinearAnalogSensors/#989048937c77 +http://developer.mbed.org/users/PennElectric/code/LinearAnalogSensors/#15afa310c137
--- a/main.cpp Tue Jun 07 11:48:37 2016 +0000
+++ b/main.cpp Tue Jun 14 09:24:12 2016 +0000
@@ -1,7 +1,12 @@
#include "mbed.h"
#include <cmath>
+#include <stdio.h>
+#include <math.h>
//#include <LinearTemp.h>
+#include "mbed.h"
+#include "TextLCD.h"
+TextLCD lcd(p19, p20, p21, p22, p23, p24); // rs, e, d4-d7
Serial pc(USBTX, USBRX);
DigitalOut myled1(LED1), myled2(LED2);
AnalogIn pin_1(p16), pin_2(p15), pin_3(p17) ;
@@ -9,6 +14,7 @@
//LinearTemp mysensor(p15, 0.0050354, -273.15);
char program_name[128] = "G3-Waterplay Project";
+float roundvalue = 0;
void salinityMeasurement();
void temperatureMeasurement();
@@ -33,6 +39,8 @@
//measure the salinity
float salt = 16.3 * vout;
pc.printf("vin: %f, vout: %f, salt: %f \n\r", vin, vout, salt);
+ roundvalue = (float)floor((salt*100.0) + 0.5)/100.0;
+ lcd.printf("Sal: %g \n", roundvalue);
}
//temperature function
@@ -53,8 +61,10 @@
//pc.printf("K0: %f, K1: %f, K2: %f \n\r", K0, K1, K2);
//pc.printf("vin: %f, vout: %f, temperature: %f \n\r", vin, vout, Celcius);
pc.printf("vin: %f, vout: %f, temperature: %f \n\r",vin, vout, Celcius);
+ roundvalue = (float)floor((Celcius*100.0) + 0.5)/100.0;
+ lcd.printf("Temp: %g \n", roundvalue);
- if (Celcius < 26){
+ if (Celcius < 30){
pin_18 = 1;
myled1 = 1;
}else{
