Analog Temperature Sensor Demo. See http://mbed.org/users/4180_1/notebook/lm61-analog-temperature-sensor/

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Fri Aug 17 15:48:22 2012 +0000
Commit message:
ver 1

Changed in this revision

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 e035f4506cd7 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Aug 17 15:48:22 2012 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+//Print temperature from LM61 analog temperature sensor
+
+//set p15 to analog input to read LM61 sensor's voltage output
+AnalogIn LM61(p15);
+
+//also setting unused analog input pins to digital outputs reduces A/D noise a bit
+//see http://mbed.org/users/chris/notebook/Getting-best-ADC-performance/
+DigitalOut P16(p16);
+DigitalOut P17(p17);
+DigitalOut P18(p18);
+DigitalOut P19(p19);
+DigitalOut P20(p20);
+
+int main()
+{
+    float tempC, tempF;
+
+    while(1) {
+        //conversion to degrees C - from sensor output voltage per LM61 data sheet
+        tempC = ((LM61*3.3)-0.600)*100.0;
+        //convert to degrees F
+        tempF = (9.0*tempC)/5.0 + 32.0;
+        //print current temp
+        printf("%5.2F C %5.2F F \n\r", tempC, tempF);
+        wait(.5);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r e035f4506cd7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Aug 17 15:48:22 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6
\ No newline at end of file