This code just prints out the current temperature sensed by a TMP102 temperature sensor over serial when requested. Here's the Python code that lets you log data locally and to a Google Docs spreadsheet: https://github.com/m01/Tiny-Temperature-Logger For an example, see: http://playground.m01.eu/live-temperature For general information about the TMP102 and mbed, see http://mbed.org/cookbook/TMP102-Temperature-Sensor An additional wiring diagram can be obtained from here: http://wiring.org.co/learning/libraries/tmp102sparkfun.html

Dependencies:   TMP102 mbed

Fork of TMP102_Serial_Logger by Michiel B.

Files at this revision

API Documentation at this revision

Comitter:
mblokzijl
Date:
Wed May 25 10:06:42 2011 +0000
Commit message:
First revision

Changed in this revision

TMP102.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP102.lib	Wed May 25 10:06:42 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/TMP102/#b469676e9a9e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 25 10:06:42 2011 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+#include "TMP102.h"
+
+#define LF "\r\n"
+
+Serial pc(USBTX, USBRX); // tx, rx to PC
+
+TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground
+
+int main()
+{
+  pc.printf("TMP102 logger ready. Press 'u' to see the temperature." LF);
+  
+  while(1) {
+    //whenever the computer sends a 'u', give it the current temperature.
+    char c = pc.getc();
+    if (c == 'u') {
+        pc.printf("%f" LF, temperature.read());
+    }
+    wait(1);
+  }
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 25 10:06:42 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da