v2.9
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* See app note:
|
||||
* https://www.melexis.com/en/documents/documentation/application-notes/application-note-mlx90614-changing-emissivity-setting
|
||||
*
|
||||
* 1. Write 0x0000 to address 0x04 (erase the EEPROM cell)
|
||||
* 2. Write the new value to address 0x04
|
||||
* 3. Read the value in address 0x04 in order to check that the correct value is stored
|
||||
* 4. Restart the module
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Adafruit_MLX90614.h>
|
||||
|
||||
//== CHANGE THIS ============
|
||||
double new_emissivity = 0.95;
|
||||
//===========================
|
||||
|
||||
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
|
||||
|
||||
void setup() {
|
||||
// Serial.begin(9600);
|
||||
// while (!Serial);
|
||||
|
||||
Serial.println("Adafruit MLX90614 Emissivity Setter.\n");
|
||||
|
||||
// init sensor
|
||||
if (!mlx.begin()) {
|
||||
Serial.println("Error connecting to MLX sensor. Check wiring.");
|
||||
while (1);
|
||||
};
|
||||
|
||||
// read current emissivity
|
||||
Serial.print("Current emissivity = "); Serial.println(mlx.readEmissivity());
|
||||
|
||||
// set new emissivity
|
||||
Serial.print("Setting emissivity = "); Serial.println(new_emissivity);
|
||||
mlx.writeEmissivity(new_emissivity); // this does the 0x0000 erase write
|
||||
|
||||
// read back
|
||||
Serial.print("New emissivity = "); Serial.println(mlx.readEmissivity());
|
||||
|
||||
// done
|
||||
Serial.print("DONE. Restart the module.");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
46
lib/Adafruit MLX90614 Library/examples/mlxtest/mlxtest.ino
Normal file
46
lib/Adafruit MLX90614 Library/examples/mlxtest/mlxtest.ino
Normal file
@ -0,0 +1,46 @@
|
||||
/***************************************************
|
||||
This is a library example for the MLX90614 Temp Sensor
|
||||
|
||||
Designed specifically to work with the MLX90614 sensors in the
|
||||
adafruit shop
|
||||
----> https://www.adafruit.com/products/1747 3V version
|
||||
----> https://www.adafruit.com/products/1748 5V version
|
||||
|
||||
These sensors use I2C to communicate, 2 pins are required to
|
||||
interface
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
#include <Adafruit_MLX90614.h>
|
||||
|
||||
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
while (!Serial);
|
||||
|
||||
Serial.println("Adafruit MLX90614 test");
|
||||
|
||||
if (!mlx.begin()) {
|
||||
Serial.println("Error connecting to MLX sensor. Check wiring.");
|
||||
while (1);
|
||||
};
|
||||
|
||||
Serial.print("Emissivity = "); Serial.println(mlx.readEmissivity());
|
||||
Serial.println("================================================");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
|
||||
Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
|
||||
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
|
||||
Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
|
||||
|
||||
Serial.println();
|
||||
delay(500);
|
||||
}
|
Reference in New Issue
Block a user