Melexis MLX90614 library

Dependents:   IR_temperature IR_temperature IR_temperature UserIntefaceLCD ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mlx90614.h Source File

mlx90614.h

00001 #include "mbed.h"
00002 
00003 //Melexis Infrared Thermometer MLX90614 Library
00004 
00005 //*****************************************************************
00006 //  Build : 2011-06-08 Hikaru Sugiura
00007 //          Only read thermo data.
00008 //  
00009 //  This program is based on Mr.Mitesh Patel's "mlx90614".
00010 //  http://mbed.org/users/mitesh2patel/programs/mlx90614/lqnetj
00011 //
00012 //  This program does not check CRC.
00013 //  If you want to check CRC, please do it your self :)
00014 //****************************************************************//
00015 
00016 /**An Interface for MLX90614
00017 * 
00018 * @code
00019 * //Print temperature data
00020 * #include "mbed.h"
00021 * #include "mlx90614.h"
00022 *
00023 * I2C i2c(p28,p27);   //sda,scl
00024 * MLX90614 thermometer(&i2c);
00025 * float temp;
00026 *
00027 * void main(void){
00028 *   if(thermometer.getTemp(&temp)){
00029 *       printf("Temperature : %f \r\n",temp);
00030 *   }
00031 *   wait(0.5);
00032 *
00033 * }
00034 * @endcode
00035 */
00036 
00037 
00038 class MLX90614{
00039 
00040     public:
00041         /** Create MLX90614 interface, initialize with selected I2C port and address.
00042         *
00043         * @param i2c I2C device pointer
00044         * @param addr Device address(default=0xB4)  
00045         */    
00046         MLX90614(I2C* i2c,int addr=0xB4);
00047         
00048         /** Get Temperature data from MLX90614. 
00049         *
00050         * @param temp_val return valiable pointer
00051         * @return 0 on success (ack), or non-0 on failure (nack)
00052         */
00053         bool getTemp(float* temp_val);
00054         
00055     private:
00056        I2C* i2c;
00057        int i2caddress;
00058 
00059 };