I2C comunication with MCP9600 Thermocouple Sensor
I have to use the MCP9600 Thermocuple Sesnor to monitor a temperature. This sensor comunicates with I2C protocol.
As can be seen in the datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/20005426C.pdf, from page 15 onwards), to catch the value you have to follow a sequence of instructions but I do not understand how to replicate them in a C program using the C libraries of Onion Omega (onion-i2c.h). Would anyone be able to help me?
This Arduino library code is only 91 lines long: https://github.com/ControlEverythingCom/MCP9600-K-Type-Thermocouple/blob/master/K-Type-9600-Thermocouple.cpp. Here's an alternative implementatino: https://ncd.io/k-type-thermocouple-mcp9600-with-arduino/
If you replace the
Wire(I2C) transfers with
i2c_readRawyou should be fine.
Thank you for answering. I see what you have posted but in that code there are used also other functions (e.g. begin, setSpeed, beginTransmission) of Arduino libraries (wire.h, spark_wiring_i2c.h, spark_wiring.h, spark_wiring_usbserial.h). How can I replace those?
you can try this python lib
or this c
You can replace i2c read write with onion syntax.