stevemarple / SoftWire

Software I2C implementation for Arduino and other Wiring-type environments
GNU Lesser General Public License v2.1
136 stars 31 forks source link

example SoftWire_MLX90614 not working #36

Open Juhuich opened 5 months ago

Juhuich commented 5 months ago

Hi Steve, I'm using a MLX90614 connected to ESP32-C3 super micro board with Arduino-IDE 2.3.2. So I tried your example "SoftWire_MLX90614", but no success. I found following problems in your example :

  1. there is no pause after Serial.begin() and so the following Serial.println("MLX90614_demo") is not done. (small problem ;-))
  2. at the function "readMLX90614(uint8_t command, uint8_t &crc)" you use "i2c.write(command);". But that does't send the command-byte on I2C-bus. I replaced it with "i2c.llWrite(command);" That works.
  3. in loop() the "readMLX90614()" is called twice to get Ambient- and Object-temperature. That leads to hang-up of the program. If I insert a little pause (for ex. : delay(1)) between the two "readMLX90614()", the program runs and both values are read fine.

While I had the problems above, I saw that you created a library for the MLX90614. So I installed it and tried example MLX90614_demo. But I got compilation error : ".....src\ MLX90614.cpp: In member function 'bool MLX90614::read(uint8_t, uint16_t&) const': d:\Program Files (x86)\Arduino\neue_Libraries\libraries\MLX90614\src\MLX90614.cpp:154:24: error: passing 'const SoftWire' as 'this' argument discards qualifiers [-fpermissive] i2c.write(command) || // Command sent" I didn't check further for that because I'm using SoftWire with the problem solutions above.

I hope my comments can help others with the same problems. Thank you Steve for SoftWire, it runs really fine in my project now.