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: easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code
Revision 49:d45c534ec444, committed 2018-03-18
- Comitter:
- DuyLionTran
- Date:
- Sun Mar 18 04:30:18 2018 +0000
- Parent:
- 48:a7ed665844cd
- Child:
- 50:5a19fc4b41d9
- Commit message:
- * version 2.8 03-17-2018: DS18B20 problem solved
Changed in this revision
--- a/Application/main.cpp Thu Mar 08 16:38:35 2018 +0000
+++ b/Application/main.cpp Sun Mar 18 04:30:18 2018 +0000
@@ -11,6 +11,7 @@
* version 2.7.5 03-08-2018: DS18B20 & IWDG is being developed
* version 2.7.5a 03-08-2018: DS18B20 problem discovered at line 42th ReadSensor.cpp
Upload RTC time converted to epoch
+ * version 2.8 03-17-2018: DS18B20 problem solved
*/
/***************************************************************
--- a/DS1820.lib Thu Mar 08 16:38:35 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://os.mbed.com/users/Sissors/code/DS1820/#236eb8f8e73a
--- a/Sensor/ReadSensor.cpp Thu Mar 08 16:38:35 2018 +0000
+++ b/Sensor/ReadSensor.cpp Sun Mar 18 04:30:18 2018 +0000
@@ -36,10 +36,10 @@
float averageVoltage;
bool isCalibrating = false;
-AnalogIn DOSensor(SENSOR_1_PIN);
+AnalogIn DOSensor(SENSOR_2_PIN);
/* Error often occurs here */
-DS1820 probe(SENSOR_2_PIN);
+DS1820 probe(SENSOR_1_PIN);
int getMedianNum(int bArray[], int iFilterLen) {
int bTab[iFilterLen];
@@ -83,8 +83,9 @@
void SENSOR_GetDOValue() {
/* Read temperature */
#ifdef PROBE_EXIST
- probe.convertTemperature(true, DS1820::all_devices);
- temperature = probe.temperature();
+ wait(0.2);
+ probe.startConversion();
+ temperature = probe.read();
#endif
for(copyIndex = 0; copyIndex < SCOUNT; copyIndex++) {
@@ -153,6 +154,11 @@
}
void SENSOR_ReadDoCharacteristicValues() {
+ if (probe.begin()) {
+ printf("sensor found\r\n");
+ probe.startConversion();
+ wait(0.5);
+ }
uint32_t int_SaturationDoVoltage = FP_ReadValue(SAT_DO_VOLT_ADDRESS);
printf("Read SaturationDoVoltage %d\r\n", int_SaturationDoVoltage);
SaturationDoVoltage = (float)int_SaturationDoVoltage;
--- a/Sensor/ReadSensor.h Thu Mar 08 16:38:35 2018 +0000 +++ b/Sensor/ReadSensor.h Sun Mar 18 04:30:18 2018 +0000 @@ -1,14 +1,14 @@ #ifndef __READSENSOR_H__ #define __READSENSOR_H__ -#define SENSOR_1_PIN (A5) -#define SENSOR_2_PIN (D8) +#define SENSOR_1_PIN (D3) +#define SENSOR_2_PIN (A4) #define SENSOR_3_PIN (A3) #define VREF 5000 #define SCOUNT 30 /* sum of sample point */ -//#define PROBE_EXIST +#define PROBE_EXIST void SENSOR_DoCalibration(uint8_t CurrentCalibrationMode); void SENSOR_AnalogRead();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensor/watersenor_and_temp_code.lib Sun Mar 18 04:30:18 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/e58136782000/code/watersenor_and_temp_code/#af21738cf2da
--- a/mbed_app.json Thu Mar 08 16:38:35 2018 +0000
+++ b/mbed_app.json Sun Mar 18 04:30:18 2018 +0000
@@ -17,10 +17,10 @@
"value": "D0"
},
"esp8266-ssid": {
- "value": "\"GreenLantern\""
+ "value": "\"KH\""
},
"esp8266-password": {
- "value": "\"deAlembert\""
+ "value": "\"kh123456\""
},
"esp8266-debug": {
"value": true