I’m trying to use a BME280 sensor with the Sparkfun BME280 library. I don’t seem to be able to change the SDA/SCL pins and I’m also getting a read error when I connect to the pins that the ESP32-C3 is sending I2C over.
#include <Wire.h>
#include "SparkFunBME280.h"
BME280 mySensor;
void setup()
{
Serial.begin(115200);
Serial.println("Example showing alternate I2C addresses");
Wire.begin();
Wire.setClock(10000); //Increase to fast I2C speed!
mySensor.setI2CAddress(0x77);
mySensor.beginI2C();
mySensor.setReferencePressure(101200); //Adjust the sea level pressure used for altitude calculations
}
void loop()
{
Serial.print("Humidity: ");
Serial.print(mySensor.readFloatHumidity(), 0);
Serial.print(" Pressure: ");
Serial.print(mySensor.readFloatPressure(), 0);
Serial.print(" Locally Adjusted Altitude: ");
//Serial.print(mySensor.readFloatAltitudeMeters(), 1);
Serial.print(mySensor.readFloatAltitudeFeet(), 1);
Serial.print(" Temp: ");
//Serial.print(mySensor.readTempC(), 2);
Serial.print(mySensor.readTempF(), 2);
Serial.println();
delay(1000);
}
The serial monitor reads:
Humidity: [271381][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
0 Pressure: [271388][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
0 Locally Adjusted Altitude: [271395][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
145442.2 Temp: [271403][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
32.00
Thank you