Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hexi_Click_IRThermo_Example
Fork of MLX90614 by
mlx90614.h@2:01d333d06727, 2011-06-09 (annotated)
- Committer:
 - aquahika
 - Date:
 - Thu Jun 09 13:28:50 2011 +0000
 - Revision:
 - 2:01d333d06727
 - Parent:
 - 1:4a60d3f1e91e
 - Child:
 - 3:eb618e916622
 
add class description
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| aquahika | 1:4a60d3f1e91e | 1 | #include "mbed.h" | 
| aquahika | 1:4a60d3f1e91e | 2 | |
| aquahika | 1:4a60d3f1e91e | 3 | //Melexis Infrared Thermometer MLX90614 Library | 
| aquahika | 1:4a60d3f1e91e | 4 | |
| aquahika | 1:4a60d3f1e91e | 5 | //***************************************************************** | 
| aquahika | 1:4a60d3f1e91e | 6 | // Build : 2011-06-08 Hikaru Sugiura | 
| aquahika | 1:4a60d3f1e91e | 7 | // Only read thermo data. | 
| aquahika | 1:4a60d3f1e91e | 8 | // | 
| aquahika | 1:4a60d3f1e91e | 9 | // This program is based on Mr.Mitesh Patel's "mlx90614". | 
| aquahika | 1:4a60d3f1e91e | 10 | // http://mbed.org/users/mitesh2patel/programs/mlx90614/lqnetj | 
| aquahika | 1:4a60d3f1e91e | 11 | // | 
| aquahika | 1:4a60d3f1e91e | 12 | // This program does not check CRC. | 
| aquahika | 1:4a60d3f1e91e | 13 | // If you want to check CRC, please do it your self :) | 
| aquahika | 1:4a60d3f1e91e | 14 | //****************************************************************// | 
| aquahika | 1:4a60d3f1e91e | 15 | |
| aquahika | 2:01d333d06727 | 16 | /************************************** | 
| aquahika | 2:01d333d06727 | 17 | **An Interface for MLX90614 | 
| aquahika | 2:01d333d06727 | 18 | * Sample Code | 
| aquahika | 2:01d333d06727 | 19 | * | 
| aquahika | 2:01d333d06727 | 20 | *@code | 
| aquahika | 2:01d333d06727 | 21 | * //Print temperature data | 
| aquahika | 2:01d333d06727 | 22 | * #include "mbed.h" | 
| aquahika | 2:01d333d06727 | 23 | * #include "mlx90614.h" | 
| aquahika | 2:01d333d06727 | 24 | * | 
| aquahika | 2:01d333d06727 | 25 | * I2C i2c(p28,p27); //sda,scl | 
| aquahika | 2:01d333d06727 | 26 | * MLX90614 thermometer(&i2c); | 
| aquahika | 2:01d333d06727 | 27 | * | 
| aquahika | 2:01d333d06727 | 28 | * void main(void){ | 
| aquahika | 2:01d333d06727 | 29 | * if(thermo.getTemp(&temp)){ | 
| aquahika | 2:01d333d06727 | 30 | * printf("Temperature : %f \r\n",temp); | 
| aquahika | 2:01d333d06727 | 31 | * } | 
| aquahika | 2:01d333d06727 | 32 | * wait(0.5); | 
| aquahika | 2:01d333d06727 | 33 | * | 
| aquahika | 2:01d333d06727 | 34 | * } | 
| aquahika | 2:01d333d06727 | 35 | *@endcode | 
| aquahika | 2:01d333d06727 | 36 | **************************************/ | 
| aquahika | 2:01d333d06727 | 37 | |
| aquahika | 2:01d333d06727 | 38 | |
| aquahika | 1:4a60d3f1e91e | 39 | class MLX90614{ | 
| aquahika | 1:4a60d3f1e91e | 40 | |
| aquahika | 1:4a60d3f1e91e | 41 | public: | 
| aquahika | 2:01d333d06727 | 42 | /** Create MLX90614 interface, initialize with selected I2C port and address. | 
| aquahika | 2:01d333d06727 | 43 | * | 
| aquahika | 2:01d333d06727 | 44 | * @param i2c I2C device pointer | 
| aquahika | 2:01d333d06727 | 45 | * @param addr Device address(default=0xB4) | 
| aquahika | 2:01d333d06727 | 46 | */ | 
| aquahika | 1:4a60d3f1e91e | 47 | MLX90614(I2C* i2c,int addr=0xB4); | 
| aquahika | 2:01d333d06727 | 48 | |
| aquahika | 2:01d333d06727 | 49 | /** Get Temperature data from MLX90614. | 
| aquahika | 2:01d333d06727 | 50 | * | 
| aquahika | 2:01d333d06727 | 51 | * @param temp_val return valiable pointer | 
| aquahika | 2:01d333d06727 | 52 | * @return 0 on success (ack), or non-0 on failure (nack) | 
| aquahika | 2:01d333d06727 | 53 | */ | 
| aquahika | 1:4a60d3f1e91e | 54 | bool getTemp(float* temp_val); | 
| aquahika | 1:4a60d3f1e91e | 55 | |
| aquahika | 1:4a60d3f1e91e | 56 | private: | 
| aquahika | 1:4a60d3f1e91e | 57 | I2C* i2c; | 
| aquahika | 1:4a60d3f1e91e | 58 | int i2caddress; | 
| aquahika | 1:4a60d3f1e91e | 59 | |
| aquahika | 0:9237d31f0d03 | 60 | }; | 
