Simple cpp wrapper of a ds18b20, onewire 'c' library. Supports multiple sensors.

Dependencies:   mbed

Dependents:   LPC11U68_DS18B20Sensor

Fork of DS18B20Sensor by Steve Spence

Revision:
3:9fd95d590149
Parent:
1:ea35ad346f25
--- a/DS18B20Sensor.h	Sun Mar 03 02:11:11 2013 +0000
+++ b/DS18B20Sensor.h	Sun Mar 03 02:22:27 2013 +0000
@@ -11,26 +11,31 @@
  *  
  * Simple Example:
  * @code
- #include "mbed.h"
- #include "DS18B20Sensor.h"
+#include "mbed.h"
+#include "DS18B20Sensor.h"
 
- DS18B20Sensor sensor(p30);
-
- int main()
- {
-    char sensorBuf[25];
+// Instantiate sensor with hardware in pin p30 
+DS18B20Sensor sensor(p30);
 
-    // count will search for sensors, if not already called
-    printf("Found %d sensor/s\r", sensor.count());
-
-    uint8_t result = sensor.startReading(true);     // start sensor readings and wait
-
-    for (uint8_t i = 0; i < sensor.count(); i++) {
-       sensor.getReadingText(sensorBuf, i);         // get result into buf
-       printf("Sensor %d : %s\r", i+1, sensorBuf);  // display it to the world
-    }
-
- }
+// Setup a window to the world
+Serial pc(p13, p14);
+//Serial pc(USBTX, USBRX);
+ 
+int main()
+{
+   char sensorBuf[25];
+ 
+   // count will search for sensors, if not already called
+   pc.printf("Found %d sensor/s\r", sensor.count());
+ 
+   uint8_t result = sensor.startReading(true);     // start sensor readings and wait
+ 
+   for (uint8_t i = 0; i < sensor.count(); i++) {
+      sensor.getReading(sensorBuf, i);         // get result into buf
+      pc.printf("Sensor %d : %s\r", i+1, sensorBuf);  // display it to the world
+   }
+ 
+}
  * @endcode
  */
 class DS18B20Sensor