First, run
File > Examples > Wire > Scanner. This will test whether your device is responding and you can easily confirm what I2C address it uses. If the scanner doesn't detect your sensor, there is no point going any further. Get it working with the scanner first.
Do you think you could walk me through it once, so I and anyone else having problems learning about this can have a resource?
I'm going to make a quick attempt to walk you though using the Wire library, but first I want to be absolutely clear that many examples and projects and libraries use Wire to access devices very similar to this sensor. Plenty of resources already exist. I want to help you, but I also want to dis-spell any notion that resources are somehow lacking, so I'm going to show how a couple of the examples are modified to work...
On the PJRC site, you can find this page for the Wire library.
https://www.pjrc.com/teensy/td_libs_Wire.html
Scroll down to "Example Program". The code I'm about to explain is from that page, so please if you haven't read the example on that page, do so now.
Now, to apply that EEPROM example to this sensor, here the info from page 12 of the datasheet.
To send this sensor a command like Figure 13, you would use the same code as the EERPOM example, but you would transmit only 1 byte.
Here is the EEPROM example code:
Code:
// set the 24C256 eeprom address to 0
Wire.beginTransmission(80);
Wire.write(0); // address high byte
Wire.write(0); // address low byte
Wire.endTransmission();
To adapt this for your sensor, just replace the address with whatever address the Scanner example found (I'm going to guess it's 118 for the sake of this message). Then change the transmitted byte for the command you want to send, and delete the second write line since this sensor expects a 1 byte command rather than 2 bytes for the address of a 24C256 EEPROM. Also update the comments....
Code:
// send "initiate a pressure conversion" command
Wire.beginTransmission(118);
Wire.write(0x48); // page 12 says "0 1 0 0 1 0 0 0"
Wire.endTransmission();
Hopefully you can see this is the same as the 24C256 EEPROM, only with the address and data byte changed.
Likewise to read data from this sensor, you would use basically the same code as the example, but you want to read 3 bytes. Since the EEPROM example reads only 1 byte, I'm going to instead copy from
File > Examples > Wire > master_reader. This example reads 8 bytes. Here is the example code:
Code:
Wire.requestFrom(8, 6); // request 6 bytes from slave device #8
while(Wire.available()) { // slave may send less than requested
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}
Serial.println();
To adapt this for your sensor, change the address and request only 3 bytes. Also change the variable to "int" type, so the results print to the Arduino Serial Monitor as numbers rather than characters.
Code:
Wire.requestFrom(118, 3); // request 3 bytes from pressure sensor
while(Wire.available()) { // slave may send less than requested
int n = Wire.read(); // receive a byte an integer
Serial.print(n); // print the number
}
Serial.println();
Hopefully with this you can see how the examples for the Wire library and code on the web page are meant to help you.