File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * See app note:
3
+ * https://www.melexis.com/en/documents/documentation/application-notes/application-note-mlx90614-changing-emissivity-setting
4
+ *
5
+ * 1. Write 0x0000 to address 0x04 (erase the EEPROM cell)
6
+ * 2. Write the new value to address 0x04
7
+ * 3. Read the value in address 0x04 in order to check that the correct value is stored
8
+ * 4. Restart the module
9
+ *
10
+ */
11
+
12
+ #include < Adafruit_MLX90614.h>
13
+
14
+ // == CHANGE THIS ============
15
+ double new_emissivity = 0.95 ;
16
+ // ===========================
17
+
18
+ Adafruit_MLX90614 mlx = Adafruit_MLX90614();
19
+
20
+ void setup () {
21
+ Serial.begin (9600 );
22
+ while (!Serial);
23
+
24
+ Serial.println (" Adafruit MLX90614 Emissivity Setter.\n " );
25
+
26
+ // init sensor
27
+ if (!mlx.begin ()) {
28
+ Serial.println (" Error connecting to MLX sensor. Check wiring." );
29
+ while (1 );
30
+ };
31
+
32
+ // read current emissivity
33
+ Serial.print (" Current emissivity = " ); Serial.println (mlx.readEmissivity ());
34
+
35
+ // set new emissivity
36
+ Serial.print (" Setting emissivity = " ); Serial.println (new_emissivity);
37
+ mlx.writeEmissivity (new_emissivity); // this does the 0x0000 erase write
38
+
39
+ // read back
40
+ Serial.print (" New emissivity = " ); Serial.println (mlx.readEmissivity ());
41
+
42
+ // done
43
+ Serial.print (" DONE. Restart the module." );
44
+ }
45
+
46
+ void loop () {
47
+ }
Original file line number Diff line number Diff line change @@ -22,13 +22,17 @@ Adafruit_MLX90614 mlx = Adafruit_MLX90614();
22
22
23
23
void setup () {
24
24
Serial.begin (9600 );
25
+ while (!Serial);
25
26
26
27
Serial.println (" Adafruit MLX90614 test" );
27
28
28
29
if (!mlx.begin ()) {
29
30
Serial.println (" Error connecting to MLX sensor. Check wiring." );
30
31
while (1 );
31
32
};
33
+
34
+ Serial.print (" Emissivity = " ); Serial.println (mlx.readEmissivity ());
35
+ Serial.println (" ================================================" );
32
36
}
33
37
34
38
void loop () {
You can’t perform that action at this time.
0 commit comments