by skoehler » Fri Feb 15, 2013 6:51 pm
So in the constructor, you don't initialize the I2C address of the sensor. It is 0x18. You can use a call to the super constructor to initialize the I2C address.
Secondly, use this.getData(0x53, outBuf, 4); According to the userguide at mindsensors.com, that will give you the 4 bytes of the RAW reading (pressue in pascal).
Use the class EndianTools to convert the 4 byte array into an 32bit integer. According to the NXC examples, the 4 bytes will be little endian.
You don't need a cmdBuff array. In NXC, the first byte of the cmdBuff is the address of the sensor (0x18), and the second byte is the register (0x53). Using getData(0x53, ...) does the same thing, as long as the address of the sensor has been configured properly.
The mind sensors userguide recommends, that using the raw value at 0x53 instead of the converted value at 0x43 provides the best resolution. Hence, I would use 0x53 and convert pascal to PSI, bar, or whatever as needed in Java.