arduino-MLX90393
arduino-MLX90393 copied to clipboard
Example missing wire.begin()
I had some trouble with several MLX90393 modules (problems were unrelated to this library), but part of my diagnostics including using the MLX90393_Debug_Helper.ino sketch in this library. Great utility, BTW!
However, it wouldn't work for me consistently. I got a lot of failures and read errors among the MLX90393 modules I was trying to use. So much so, I purchased more thinking they were bad (they weren't).
The problem? The sketch is missing wire.begin(). Add that to the setup() and it reads my modules every time. No errors.
Me also.
I added a line in begin function of library class and everything work for me.
uint8_t MLX90393:: begin(uint8_t A1, uint8_t A0, int DRDY_pin, TwoWire &wirePort) { I2C_address = I2C_BASE_ADDR | (A1?2:0) | (A0?1:0); this->DRDY_pin = DRDY_pin; if (DRDY_pin >= 0){ pinMode(DRDY_pin, INPUT); }
_i2cPort = &wirePort; //Grab which port the user wants us to use _i2cPort->begin(); // <------- add line here
uint8_t status1 = checkStatus(reset()); uint8_t status2 = setGainSel(7); uint8_t status3 = setResolution(0, 0, 0); uint8_t status4 = setOverSampling(3); uint8_t status5 = setDigitalFiltering(7); uint8_t status6 = setTemperatureCompensation(0);
return status1 | status2 | status3 | status4 | status5 | status6; }