Method of reading from DS1825 thermometer, including the OneWire method. Specific for the use of just 1 sensor.

Dependencies:   OneWire

Dependents:   Inductive_Sensor Inductive_Sensor_Jasper Inductive_Sensor_3

Revision:
2:653e20bb069d
Parent:
1:ef7e5efc8794
--- a/DS1825.cpp	Wed Sep 21 14:24:28 2016 +0000
+++ b/DS1825.cpp	Wed Oct 05 08:14:49 2016 +0000
@@ -31,23 +31,27 @@
 }
 
 float DS1825::getTemperature( void )
-{    
-    // If the thermometer is not ready, just send the previous value
-    // don't interupt the conversion!
+{     
+    // If the thermometer is not read (it takes 750 ms), 
+    // just send the previous value.
+    // Don't interupt the conversion!
     if ( clock() - lastconversion  < 750 / 10 )
         return T;
 
-    // Read the data 
+    // Send command to read the data 
     _onewire->reset();
     _onewire->skip();                // Skip ROM
     _onewire->write( 0xBE );         // Command to read scratchpad
     
-    // Convert to temperature
+    // Read the data
     uint8_t Tdata[9];
     for (int i = 0; i < 9; i++) 
         Tdata[i] = _onewire->read(); // read scratchpad    
     _onewire->depower();
     
+    // Send the command to start calculating the new temperature
+    convertTemperature();
+    
     // validate the result
     if( validateTemperature( Tdata ) )
     {