Skip to content

Examples update for emissivity #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions examples/mlx_set_emissivity/mlx_set_emissivity.ino
Original file line number Diff line number Diff line change
@@ -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() {
}
4 changes: 4 additions & 0 deletions examples/mlxtest/mlxtest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ 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() {
Expand Down