Hi, I’m doing my very first Arduino project and I’m running into some trouble. Im trying to connect a BME280 to my Nano board. The default SDA and SCL pins on this board are assigned to a qwiic connector which I can’t use. So I need to connect it to some other pins. I’m following the steps provided in https://forum.sparkfun.com/viewtopic.php?t=51004 this answer, since it’s basically the problem I have, but I’m running into new problems. My code is this (excluded the loop):
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
TwoWire myWire(3);
void setup() {
Serial.begin(9600);
myWire.begin();
if (!bme.begin(0x76, myWire)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
and my error is this:
C:\Users\Dave\Documents\Arduino\meh\meh.ino: In function 'void setup()':
meh:14:30: error: no matching function for call to 'Adafruit_BME280::begin(int, TwoWire&)'
if (!bme.begin(0x76, myWire)) {
^
In file included from C:\Users\Dave\Documents\Arduino\meh\meh.ino:3:
C:\Users\Dave\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:218:8: note: candidate: 'bool Adafruit_BME280::begin(uint8_t, TwoWire*)'
bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire);
^~~~~
C:\Users\Dave\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:218:8: note: no known conversion for argument 2 from 'TwoWire' to 'TwoWire*'
exit status 1
no matching function for call to 'Adafruit_BME280::begin(int, TwoWire&)'
So I’m using the Adafruit library and I don’t understand what’s wrong, I thought I’m doing something that is allowed: https://github.com/adafruit/Adafruit_BM … st.ino#L46 adafruit method.
Would greatly appreciate any kind of help. I’m a Java programmer but the world of Arduino is very new to me!