And finally the code with the psi-output value:
var i2c = new I2C(); i2c.setup({ scl : D29, sda: D28 }); var output_bit; var output_max; var output_min; var P_max = 1; var P_min = -1; var pressure1; var pressure2; var pressure_final; setInterval(() => { i2c.writeTo(0x18, 0xAA, 0x00, 0x00); setTimeout(() => { let output = i2c.readFrom(0x18, 5); var output_bit = output[1] *100 *100 + output[2]*100 + output[3]; console.log(output_bit); var pressure1 = (output_bit-1200000)*(1-(-1)); var pressure2 = pressure1/(1500000-1200000); var pressure_final = pressure2 + (-1) - 0.4; console.log(pressure_final); }, 100); }, 300);
@psc1988 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
And finally the code with the psi-output value: