Simple DS1820 sensor demo showing how to use the DS1820 library [https://developer.mbed.org/users/hudakz/code/DS1820/]

Dependencies:   DS1820

Revision:
2:a680194ce6df
Parent:
1:fe12bf2ad337
Child:
3:eb195375cde7
--- a/main.cpp	Thu Mar 26 20:58:32 2015 +0000
+++ b/main.cpp	Thu Mar 26 21:12:05 2015 +0000
@@ -15,8 +15,8 @@
     DS1820  ds1820(PA_9);    // substitute PA_9 with actual mbed pin name connected to the DS1820 data pin    
                              
     if(ds1820.begin()) {
-        ds1820.startConversion();
-        wait(1.0);
+        ds1820.startConversion();   // start temperature conversion
+        wait(1.0);                  // let DS1820 complete the temperature conversion
         while(1) {
             serial.printf("temp = %3.1f\r\n", ds1820.read());     // read temperature
             ds1820.startConversion();     // start temperature conversion
@@ -37,14 +37,14 @@
 //            serial.printf("Couldn't find sensor %d", i);
 //        } else
 //            ds1820[i].startConversion();
-//    }
-//    
-//    wait(1.0);  // let DS1820s complete the temperature conversion
-//    
+//    }   
+//    wait(1.0);  // let DS1820s complete the temperature conversion    
 //    while(1) {
 //        for(int i = 0; i < 3; i++) {
-//            serial.printf("temp%d = %3.1f\r\n", i, ds1820[i].read());     // read temperature
-//            ds1820[i].startConversion();     // start temperature conversion
+//            if(ds1820[i].present) {
+//                serial.printf("temp%d = %3.1f\r\n", i, ds1820[i].read());     // read temperature
+//                ds1820[i].startConversion();     // start temperature conversion
+//            }
 //        }
 //        wait(1.0);  // let DS1820s complete the temperature conversion
 //    }