Hello,
I am trying to program a BMP581 sensor to simply measure pressure and temperature. I used the example code provided by SparkFun. I am not getting any readings. My wiring is correct. I cannot pinpoint where my issue lies. I would appreciate some help.
#include "SparkFun_BMP581_Arduino_Library.h"
#include <Wire.h>
BMP581 pressureSensor; // Create a new sensor object
uint8_t i2cAddress = BMP581_I2C_ADDRESS_DEFAULT;
void setup() {
Wire.begin(); // Start I2C bus
delay(500); // wait
Serial.begin(115200); // Start Serial connection
Serial.println("BMP581 Begin!");
/* Initialize the sensor */
while(pressureSensor.beginI2C(i2cAddress) != BMP5_OK)
{
// Not connected --> inform user
Serial.println("Error: BMP581 not connected - check wiring and I2C address!");
// Wait
delay(1000);
}
Serial.println("BMP581 Connected!");
}
void loop() {
// Get measurements from the sensor
bmp5_sensor_data data = {0};
int8_t err = pressureSensor.getSensorData(&data);
// Check whether data was acquired successfully
if(err == BMP5_OK)
{
Serial.print("Temperature (C): ");
Serial.print(data.temperature);
Serial.print("\t\t");
Serial.print("Pressure (Pa): ");
Serial.println(data.pressure);
}
else{
Serial.print("Error getting data from sensor! Error Code: ");
Serial.println(err);
}
delay(1000);
}
Thank you