Hello, I have a SDP810 differential pressure sensor that works with i2c. It’s pressure data is stored in the first two bits of SDA, where the temperature data is stored in the 4th and the 5th. I can obtain the first two bits simply by the following code snippet
//Read pressure from SDP810 int16_t Pres_Raw; //16 bit intiger to store the msb and lsb double Pres; //Double precision float to store actual pressure reading byte msb; byte lsb; Wire.requestFrom(0x25, 2); //Contents of first two bytes msb = Wire.read(); //Byte1 is msb lsb = Wire.read(); //Byte2 is lsb Pres_Raw = msb<<8; //Assign msb to combined variable Pres_Raw |= lsb; //Add the lsb to the combined variable Pres = Pres_Raw/float(240); //Divide the raw reading by the scaling factor (page 10 in cut sheet)
However, I am really struggling to read the temperature data. I am trying to obtain it by first getting the first getting the first 5 bits, discarding the first 3 and using the remaining ones with this code.
//byte gen = Wire.requestFrom(0x25,5); //byte a = Wire.read(); //byte b = Wire.read(); //byte c = Wire.read(); //byte d = Wire.read(); //byte e = Wire.read(); //int16_t temp_raw = d << 8 | e; //temp = temp_raw/float(60);
In conclusion, I want to obtain both of these datas simultaneously and print them. Any help would be much appreciated.