BMP085 NEed help with pressure

I have a code for pumps being ran by a pressure being read from a BMP085 sensor but i dont know how to make the long code that everyone seems to have go together with this one. I want to enter a depth or pressure that i want the pumps to take an ROV down to and i need some help doing that. Any help would be appreciated. This is what i have so far

#include <Wire.h>
#define BMP085_ADDRESS 0x77 // I2C address of BMP085

int pwmPin_A = 3; // output pin supporting PWM
int pwmPin_B = 11; // output pin supporting PWM
int inPin = 5; // pressure sensor voltage connected to analog pin 4
int val = 4; // variable to store the read value
float volt = 0; // variable to hold the voltage read
void setup()
{
Serial.begin(9600);
Serial.println(“Both pumps tested”);

pinMode(pwmPin_A, OUTPUT); // sets the pin as output
analogWrite(pwmPin_A, 128); // primes the pump at half power
delay(2000); // pump runs for 1/2 second
analogWrite(pwmPin_A, 0); // shuts off the pump
pinMode(pwmPin_B, OUTPUT); // sets the pin as output
analogWrite(pwmPin_B, 128); // primes the pump at half power
delay(2000); // pump runs for 1/2 second
analogWrite(pwmPin_B, 0); // shuts off the pump
}
void loop()
{
int valMap;
val = analogRead(inPin); // read the input pin
Serial.begin(9600);
Serial.println(“BnalogRead(inPin)”);
valMap = map(val, 0, 1023, 255, 0);
if (val <= 700)
{
analogWrite(pwmPin_A, valMap);
analogWrite(pwmPin_B, valMap);// runs pump until set pressure reached
}
//analogWrite(pwmPin_A, 0);
//analogWrite(pwmPin_B, 0);// shuts pump off
if (val > 700) // 700 is about 40 PSI
{
analogWrite(pwmPin_A, 0); // shuts pump off
analogWrite(pwmPin_B, 0); // shuts pump off
}
}

I suggest to use the Adafruit library:

Click on 'tutorial' for the turorial and the library.
Use the example to read the baromic pressure in kPa.
Don't try to use the altitude if you don't need it, I think that is confusing (at least for me it is).

I need to tie this one in with the one you mentioned and i have no idea how its done

Did you try the example with that library ?
Do you see some values (and the pressure in Pa) printed on the serial monitor ?
The pressure is "bmp.readPressure()", you can use the value from that to test for a certain pressure.

BMP085 is an atmospheric pressure sensor, it would be quite unsuitable for measuring water pressure.

Are you using a BMP085 breakout board like the one from Adafruit? If so, everything is done over I2C. I see:

val = analogRead(inPin); // read the input pin

Even though you defined the I2C address of the sensor, you’re reading it in from an analog port. The BMP085 is a digital sensor, and thus must be read over I2C.

I would suggest starting with the Adafruit library’s examples and then adapting them to your needs as opposed to starting from scratch.

Also:

michinyon:
BMP085 is an atmospheric pressure sensor, it would be quite unsuitable for measuring water pressure.