This is a thermometer using DS1820. With DS1820 library of Michael Hagberg, I just used most of the sample cords. Please see notebook [http://mbed.org/users/jf1vrr/notebook/ds1820-thermometer/].

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
jf1vrr
Date:
Thu Apr 28 08:18:58 2011 +0000
Commit message:
Rev. 0.01A 2011/04/28 New

Changed in this revision

DS1820.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 5f5b4e506d94 DS1820.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS1820.lib	Thu Apr 28 08:18:58 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Michael_/code/DS1820/#ee820a991b95
diff -r 000000000000 -r 5f5b4e506d94 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Apr 28 08:18:58 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r 5f5b4e506d94 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 28 08:18:58 2011 +0000
@@ -0,0 +1,43 @@
+/* This is a thermometer using DS1820. With DS1820 library 
+of Michael Hagberg, I just used most of the sample cords.
+Please see notebook [http://mbed.org/users/jf1vrr/notebook/ds1820-thermometer/].
+*/
+#include "mbed.h"
+#include "TextLCD.h"
+#include "DS1820.h"
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+
+const int MAX_PROBES = 1;
+DS1820* probe[MAX_PROBES];
+
+int main() {
+    int i;
+    int devices_found=0;
+    // Initialize the probe array to DS1820 objects
+     for (i = 0; i < MAX_PROBES; i++)
+        probe[i] = new DS1820(p19);
+    // Initialize global state variables
+    probe[0]->search_ROM_setup();
+    // Loop to find all devices on the data line
+    while (probe[devices_found]->search_ROM() and devices_found<MAX_PROBES-1)
+        devices_found++;
+    // If maximum number of probes are found, 
+    // bump the counter to include the last array entry
+    if (probe[devices_found]->ROM[0] != 0xFF)
+        devices_found++;
+
+    lcd.cls();
+    if (devices_found==0)
+        lcd.printf("No devices found");
+    else {
+        lcd.printf("DS1820 Thermo" );
+        while (true) {
+            probe[0]->convert_temperature(DS1820::all_devices);
+            lcd.locate(0,1);
+            for (i=0; i<devices_found; i++) {
+                lcd.printf("%4.1fc",probe[i]->temperature('c'));
+            }
+        }
+    }
+}
diff -r 000000000000 -r 5f5b4e506d94 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 28 08:18:58 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912