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

Dependencies:   mbed

Dependents:   DS18B20Sensor DS18B201

Files at this revision

API Documentation at this revision

Comitter:
jsteve
Date:
Sun Mar 03 02:22:27 2013 +0000
Parent:
2:70ea3ce2f345
Commit message:
Updated documentation.

Changed in this revision

DS18B20Sensor.h Show annotated file Show diff for this revision Revisions of this file
--- 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