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.
Fork of MLX90614 by
MLX90614.cpp
00001 #include "MLX90614.h" 00002 00003 MLX90614::MLX90614(I2C *i2c) : i2c_(i2c) { 00004 } 00005 00006 float MLX90614::readTemp(uint8_t reg) { 00007 char cmd[3] = { 0 }; 00008 cmd[0] = ram_access | reg; 00009 i2c_->write(default_addr, cmd, 1, true); 00010 i2c_->read(default_addr, cmd, 3); 00011 return 0.02f * static_cast<float>(((cmd[1] & 0x7F) << 8) | cmd[0]) - 273.15f; 00012 } 00013 00014 00015 float MLX90614::ambientTemp(){ 00016 return readTemp(T_ambient); 00017 } 00018 00019 float MLX90614::objectTemp(){ 00020 return readTemp(T_obj1); 00021 }
Generated on Mon Jul 25 2022 16:11:31 by
