MLX90614 sensor - I2C IR non-contact thermometer demo program

Dependencies:   mbed MLX90614

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Tue Feb 21 01:47:13 2012 +0000
Commit message:

Changed in this revision

MLX90614.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/MLX90614.lib	Tue Feb 21 01:47:13 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aquahika/code/MLX90614/#dcd4fe76bd13
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 21 01:47:13 2012 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "mlx90614.h"
+
+DigitalOut myled(LED1); //displays I2C wait
+I2C i2c(p28,p27);   //sda,scl
+Serial pc(USBTX,USBRX);  //serial usb config
+
+MLX90614 IR_thermometer(&i2c);
+//setup an MLX90614 using MLX90614 library from
+// http://mbed.org/users/aquahika/libraries/MLX90614/lsixz6
+
+float temp; //temperature in degrees C
+
+int main() {
+    while (1) {
+        myled=1; // if led1 on - waiting on I2C
+        if (IR_thermometer.getTemp(&temp)) {
+            //gets temperature from sensor via I2C bus
+            myled=0;
+            //print temperature on PC
+            printf("Temperature is %5.1F degrees C\r\n",temp);
+        }
+        //wait for device to produce next temperature reading
+        wait(0.5);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 21 01:47:13 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/14f4805c468c