Buen dia foristas y moderadores!
Mi nombre es Eduardo y les escribo en busca de un poco de ayuda, tips o consejos todo es bienvenido.
Soy un principiante en programar en arduino (IDE), y en estos momentos estoy haciendo una central meteorologica la cual ya tengo casi todos los sensores trabajando, a excepcion del BMP180, el cual mide la presion barometrica.
El error surgio cuando realice modificaciones al codigo, ya que ademas de la presion, tambien media temperatura, la cual ya la realiza un DHT22. Asi que trate de quitar esa parte del codigo, (eliminar el sensor de temperatura).
A continuacion muestro el codigo que modifique:
(En la parte subrayada y en negritas esta el error).
#include <SFE_BMP180.h> https://github.com/sparkfun/BMP180_Breakout_Arduino_Library
#include <Wire.h>
SFE_BMP180 bmp180;
void setup()
{
Serial.begin(9600);
}
void loop()
{
char status;
double P;
status = bmp180.startPressure(3); //Inicio lectura de presión
if (status != 0)
{
delay(status);//Pausa para que finalice la lectura
[b] status = bmp180.getPressure(P); //Obtenemos la presión [u][/u][/b]
if (status != 0)
{
Serial.print("Presion: ");
Serial.print(P,2);
Serial.println(" mb");
}
}
delay(1000);
}
La respuesta del IDE es la siguiente:
exit status 1
no matching function for call to 'SFE_BMP180::getPressure(double&)'
Por mi parte seguire buscando mas informacion para encontrar una solucion a este problema.
Les agradesco mucho cualquier ayuda que puedan brindarme, gracias buen dia.
Para responder a eso debes poner el link de donde bajaste tu librería, podemos estar todo el día bajando y probando librerías.
yo suelo hacer ultimamente esto cuando incluyo una libreria
#include <SFE_BMP180.h> // http:// donde corresponda que la encontré
Este es el ejemplo de la librería
/* SFE_BMP180 altitude example sketch
This sketch shows how to use the Bosch BMP180 pressure sensor
as an altimiter.
https://www.sparkfun.com/products/11824
Like most pressure sensors, the BMP180 measures absolute pressure.
Since absolute pressure varies with altitude, you can use the pressure
to determine your altitude.
Because pressure also varies with weather, you must first take a pressure
reading at a known baseline altitude. Then you can measure variations
from that pressure
Hardware connections:
- (GND) to GND
+ (VDD) to 3.3V
(WARNING: do not connect + to 5V or the sensor will be damaged!)
You will also need to connect the I2C pins (SCL and SDA) to your
Arduino. The pins are different on different Arduinos:
Any Arduino pins labeled: SDA SCL
Uno, Redboard, Pro: A4 A5
Mega2560, Due: 20 21
Leonardo: 2 3
Leave the IO (VDDIO) pin unconnected. This pin is for connecting
the BMP180 to systems with lower logic levels such as 1.8V
Have fun! -Your friends at SparkFun.
The SFE_BMP180 library uses floating-point equations developed by the
Weather Station Data Logger project: http://wmrx00.sourceforge.net/
Our example code uses the "beerware" license. You can do anything
you like with this code. No really, anything. If you find it useful,
buy me a beer someday.
V10 Mike Grusin, SparkFun Electronics 10/24/2013
V1.1.2 Updates for Arduino 1.6.4 5/2015
*/
// Your sketch must #include this library, and the Wire library.
// (Wire is a standard library included with Arduino.):
#include <SFE_BMP180.h>
#include <Wire.h>
// You will need to create an SFE_BMP180 object, here called "pressure":
SFE_BMP180 pressure;
double baseline; // baseline pressure
void setup()
{
Serial.begin(9600);
Serial.println("REBOOT");
// Initialize the sensor (it is important to get calibration values stored on the device).
if (pressure.begin())
Serial.println("BMP180 init success");
else
{
// Oops, something went wrong, this is usually a connection problem,
// see the comments at the top of this sketch for the proper connections.
Serial.println("BMP180 init fail (disconnected?)\n\n");
while(1); // Pause forever.
}
// Get the baseline pressure:
baseline = getPressure();
Serial.print("baseline pressure: ");
Serial.print(baseline);
Serial.println(" mb");
}
void loop()
{
double a,P;
// Get a new pressure reading:
P = getPressure();
// Show the relative altitude difference between
// the new reading and the baseline reading:
a = pressure.altitude(P,baseline);
Serial.print("relative altitude: ");
if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
Serial.print(a,1);
Serial.print(" meters, ");
if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
Serial.print(a*3.28084,0);
Serial.println(" feet");
delay(500);
}
double getPressure()
{
char status;
double T,P,p0,a;
// You must first get a temperature measurement to perform a pressure reading.
// Start a temperature measurement:
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
// Use '&T' to provide the address of T to the function.
// Function returns 1 if successful, 0 if failure.
status = pressure.getTemperature(T);
if (status != 0)
{
// Start a pressure measurement:
// The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startPressure(3);
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed pressure measurement:
// Note that the measurement is stored in the variable P.
// Use '&P' to provide the address of P.
// Note also that the function requires the previous temperature measurement (T).
// (If temperature is stable, you can do one temperature measurement for a 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");
}
la unica diferencia que veo es que
Retrieve the completed pressure measurement:
// Note that the measurement is stored in the variable P.
// Use '&P' to provide the address of P.
// Note also that the function requires the previous temperature measurement (T).
// (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
// Function returns 1 if successful, 0 if failure.
status = pressure.getPressure(P,T); // <== ESTA LINEA