The Adafruit_MLX90614-library has this begin-function in the
Adafruit_MLX90614.cpp
bool Adafruit_MLX90614::begin(uint8_t addr, TwoWire *wire) {
_addr = addr; // needed for CRC
if (i2c_dev)
delete i2c_dev;
i2c_dev = new Adafruit_I2CDevice(addr, wire);
return i2c_dev->begin();
}
Do I understand right that If I want to use f.e. an ESP32 with non-standard-I²C-io-pins I would have to code it this way
#define I2C_SDA 16
#define I2C_SCL 17
#define MLX90614_I2C_ADRR 0x5a
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("Setup-Start");
PrintFileNameDateTime();
Wire.begin(I2C_SDA, I2C_SCL);
if ( !mlx.begin(MLX90614_I2C_ADRR,Wire) ) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
Serial.println("microcontroller freezed with while(true)");
while (true);
};
}
or do I have two code
mlx.begin(MLX90614_I2C_ADRR,*Wire)
mlx.begin(MLX90614_I2C_ADRR, *Wire)
best regards Stefan
Neither. The begin() function takes a pointer to an object of the TwoWire class. So it would be:
mlx.begin(MLX90614_I2C_ADRR, &Wire)
Hi @gfvalvo
thank you very much for answering quick.
Code does compile. Now I have to do a real test....
system
Closed
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.