Example TMP175 Temperature Sensor

Dependencies:   mbed TMP175

Files at this revision

API Documentation at this revision

Comitter:
Suky
Date:
Wed Feb 02 23:55:35 2011 +0000
Commit message:

Changed in this revision

TMP175.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 3023b326249a TMP175.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP175.lib	Wed Feb 02 23:55:35 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Suky/code/TMP175/#e177f6671b88
diff -r 000000000000 -r 3023b326249a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 02 23:55:35 2011 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "TMP175.h"
+DigitalOut myled(LED1);
+TMP175 mySensor(p9,p10);
+LocalFileSystem local("mbedMemory"); 
+
+int main(){
+    char Fmt[100];
+    float Temp;
+    mySensor.vSetConfigurationTMP175(SHUTDOWN_MODE_OFF|COMPARATOR_MODE|POLARITY_0|FAULT_QUEUE_6|RESOLUTION_12,0x48); // Address -> A0,A1,A2=0
+    mySensor.vSetTemperatureLowTMP175(25.0);
+    mySensor.vSetTemperatureHighTMP175(35.0);
+    
+    FILE *fp = fopen("/mbedMemory/TMP175Debug.txt", "w"); 
+    fprintf(fp, "TMP175/75 mbed NXP:\r\n"); 
+    for(int k=0;k<100;k++){
+        Temp=mySensor;
+        sprintf(&Fmt[0],"Temperature: %f ºC\r\n",Temp);
+        fprintf(fp,&Fmt[0]); 
+        myled = 1;
+        wait(0.5);
+        myled = 0;
+        wait(0.5);
+    }
+    fclose(fp);
+    while(1);
+}
diff -r 000000000000 -r 3023b326249a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Feb 02 23:55:35 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1