Basically the first byte you will receive is the status byte, then the 3 next bytes are meant to be concatenated to form a 24-bit value (see step 3 of table 17, page 16 of the corresponding datasheet). The sample code for this first step is shown here in the code
Once you get your 24-bit value, you need to convert it to a meaningful value, as shown on page 19 of the datasheet or here in the code
I don't think you need to read 5 bytes out of the sensor (var x = i2c.readFrom(0x18, 5);), IMO you can just try reading 4 bytes, and use the 3 last bytes to calculate the pressure value.
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.
Hi @psc1988,
There is a sample code for Arduino given by Adafruit: https://github.com/adafruit/Adafruit_MPRLS/blob/master/Adafruit_MPRLS.cpp
Basically the first byte you will receive is the status byte, then the 3 next bytes are meant to be concatenated to form a 24-bit value (see step 3 of table 17, page 16 of the corresponding datasheet). The sample code for this first step is shown here in the code
Once you get your 24-bit value, you need to convert it to a meaningful value, as shown on page 19 of the datasheet or here in the code
I don't think you need to read 5 bytes out of the sensor (
var x = i2c.readFrom(0x18, 5);
), IMO you can just try reading 4 bytes, and use the 3 last bytes to calculate the pressure value.