DFRobot / DFRobot_MLX90614

DFRobot IR Thermometer Sensor MLX90614
MIT License
8 stars 16 forks source link

I2c pins not modified #8

Closed freeck closed 8 months ago

freeck commented 8 months ago

Hi there, It seems that i am not able to change the default io-pins for the i2c communication. It works fine with pins 4 and 5 defined in arduino-pins.h but not with 0 and 2. Pins 0 and 2 works fine with other i2c devices and drivers. I tried using: Wire.begin(0.2); // Wire.pins(0,2) // no effect sensor = DFRobot_MLX90614_I2C_ADDR, &Wire);
while ( NO_ERR != sensor.begin() ) { ....error message occures } Perhaps you have a better code-snippet?

I am using an esp8266 board. Sloeber IDE. Ps: I will try the Arduino IDE as well! -》same result

qsjhyy commented 8 months ago

The module needs a special signal from the i2c pin for initialization (exit sleep mode) for special reasons. Due to the need to manually control the io port, but there was no reserved interface at that time, the default pin of i2c was directly used, so there would be problems you said. image So if you just need to use this module alone, the easier way is to directly modify the default pin in pins_arduino.h: image

freeck commented 8 months ago

@qsjhyy thank you very much for your quick response! Clear. In my case its no problem to permanently change the default io pins to 0 and 2 in arduino-pins.h. I already got it working that way.

qsjhyy commented 8 months ago

You are welcome, the interface may be added later, easy to use!