SM9541 140C-S-C-3-S Arduino Code

Hi everyone,

I can find Arduino Code in the community repository for AMS 5812 but nothing for the SM9541
Can anyone tell me how to convert the Pressure Data for this sensor.

Thanks

Here is some Python code that has been tested, should be easy enough to rewrite it for Arduino:

class SM9541():
    def __init__(self):
            self.pressure = 0
    def read(self):
            status = bus.read_i2c_block_data(0x28, 0x00, 2)
            if(status[0] & 192 == 0):
                    value = (((status[0]&63) << 8) + status[1])
                    converted = self.convert(value, 1638, 14745, 0, 20)
                    self.pressure = converted - 10

            return self.pressure

    def convert(self, value, leftMin, leftMax, rightMin, rightMax):
            leftSpan = leftMax - leftMin
            rightSpan = rightMax - rightMin

            valueScaled = float(value - leftMin) / float(leftSpan)

            return rightMin + (valueScaled * rightSpan)