Can someone explain what this does?
hello there, iv been working bmp180 sparkfun , don't know chunk of code exactly. doesn't first loop current pressure , baseline altitude function library? if point of below?
thanks insight this.
code: [select]
double getpressure()
{
char status;
double t,p,p0,a;
// must first temperature measurement perform pressure reading.
// start temperature measurement:
// if request successful, number of ms wait returned.
// if request unsuccessful, 0 returned.
status = pressure.starttemperature();
if (status != 0)
{
// wait measurement complete:
delay(status);
// retrieve completed temperature measurement:
// note measurement stored in variable t.
// use '&t' provide address of t function.
// function returns 1 if successful, 0 if failure.
status = pressure.gettemperature(t);
if (status != 0)
{
// start pressure measurement:
// parameter oversampling setting, 0 3 (highest res, longest wait).
// if request successful, number of ms wait returned.
// if request unsuccessful, 0 returned.
status = pressure.startpressure(3);
if (status != 0)
{
// wait measurement complete:
delay(status);
// retrieve completed pressure measurement:
// note measurement stored in variable p.
// use '&p' provide address of p.
// note function requires previous temperature measurement (t).
// (if temperature stable, can 1 temperature measurement number of pressure measurements.)
// function returns 1 if successful, 0 if failure.
status = pressure.getpressure(p,t);
if (status != 0)
{
return(p);
}
else serial.println("error retrieving pressure measurement\n");
}
else serial.println("error starting pressure measurement\n");
}
else serial.println("error retrieving temperature measurement\n");
}
else serial.println("error starting temperature measurement\n");
}
thanks insight this.
the code reads temperature , pressure connected sensor.
Arduino Forum > Using Arduino > Programming Questions > Can someone explain what this does?
arduino
Comments
Post a Comment