Test Temperature Sensor(DS18B20) for LPC11U68 Xpresso v2

Dependencies:   DS18B20Sensor mbed

LPC11U68 + DS18B20

refer to note

Files at this revision

API Documentation at this revision

Comitter:
Bongjun
Date:
Fri Jul 04 00:09:14 2014 +0000
Commit message:
USE Temperature Sensor to LPC11U68 B/D

Changed in this revision

DS18B20Sensor.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 47d0b1f8b11d DS18B20Sensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS18B20Sensor.lib	Fri Jul 04 00:09:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Bongjun/code/DS18B20Sensor/#0bcc4e42fec0
diff -r 000000000000 -r 47d0b1f8b11d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 04 00:09:14 2014 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "DS18B20Sensor.h"
+
+DigitalOut myled(LED1);
+Serial serial(USBTX, USBRX);
+DS18B20Sensor sensor(P1_25);
+// I set P1_25 here, but it's not affected code. (looked into library..no use this pinname)
+// Instead of this line, please refer to define statment of "onewire.h".
+// Thanks Steve Spence @ <<library /users/jsteve/code/DS18B20Sensor/>>
+
+int main()
+{
+    uint8_t result;
+    uint8_t i;
+    char sensorBuf[25];
+
+    serial.printf("Temperature Sensor DS18B20 Test.\rFound %d sensors\r", sensor.count());
+    while(1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+        result = sensor.startReading(true);     // start sensor readings and wait
+        if (result == DS18X20_OK) {
+            for (i = 0; i < sensor.count(); i++) {
+                sensor.getReading(sensorBuf, i);         // get result into buf
+                serial.printf("Sensor %d : %s\r", i+1, sensorBuf);  // display it to the world
+            }
+        } else {
+            serial.printf("Sensor Reading Error (%d)\r", result);  // display it to the world
+
+        }
+
+    }
+}
diff -r 000000000000 -r 47d0b1f8b11d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 04 00:09:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file