I am trying to get two of the MLX90416 sensors to tell me two different temps but I cannot get them both to work. I have got one to work, then i added the second and had to change the address of it from "0x5A" to "0x5B"
Now I am lost and don't know how to read this second address. I have copied someone's code to get them to work from this discussion... How to connect Two MLX90614 Temperture Sensors
everything in the code seems fine but the "AddrSet" is bringing up error:
"'class Adafruit_MLX90614' has no member named 'AddrSet'"
and that seems to be the only issue at the minute.
Could someone please help me with a way to make the code valid or a different way to read two of these sensors values.
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#define leftTemp 0x5A
#define rightTemp 0x5B
Adafruit_MLX90614 mlx;
float getLeftTemp(){
mlx.AddrSet(leftTemp);
return mlx.readObjectTempC();
}
float getRightTemp(){
mlx.AddrSet(rightTemp);
return mlx.readObjectTempC();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Adafruit MLX90614 test");
mlx.begin();
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Left:");
Serial.print(getLeftTemp());
Serial.println();
Serial.print("Right:");
Serial.print(getRightTemp());
delay (2000);
}
Hi, it has been a while but i used this link to change the address of one sensor then was able to run the code snippet. Just make sure you have the library Adafruit_MLX90614 and maybe check the docs as they may have changed it when setting an address.
// setAddress(<newAdd>) can set the MLX90614's 7-bit I2C bus address.
// The <newAdd> parameter should be a value between 0x01 and 0x7F.
// The function returns 1 on success and 0 on failure.
// The new address won't take effect until the device is reset.
bool setAddress(uint8_t newAdd);
I have changed and checked the address and I have managed to change it to 0x5A and 0x5B so that should work fine. I will try and look into the library and see what has changed since the guy who posted this code before a few years ago.
I have checked I have the library and have tried to check the docs but I couldn't find anything about reading multiple addresses. I know that I have successfully changed the address but I cant manage to read them both at the same time.