I have a NodeMCU 1.0 and a WeMos D1 mini.
I want to connect a BME280 sensor via I2C and I am using the Adafruit_BME280_Library
Unfortunately it simply does not work
The example code sais:
Adafruit_BME280 bme; // I2C
bme.begin()
Unfortunately I can not set up the I2C pins the way I want. So I have to find out the "original" I2C pins and I don't succeed so far.
All I get is this:
BME280 test
Could not find a valid BME280 sensor, check wiring!
Soft WDT reset
ctx: cont
sp: 3ffefa10 end: 3ffefbf0 offset: 01b0
>>>stack>>>
3ffefbc0: 3fffdc20 00000000 3ffefc3c 40201cb9
3ffefbd0: 00000000 00000000 3ffeebb4 40202e4e
3ffefbe0: 00000000 00000000 3ffeebd0 40100114
<<<stack<<<
My sketch is a very simple one - it looks like this:
/***************************************************************************
This is a library for the BME280 humidity, temperature & pressure sensor
Designed specifically to work with the Adafruit BME280 Breakout
----> http://www.adafruit.com/products/2650
These sensors use I2C or SPI to communicate, 2 or 4 pins are required
to interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit andopen-source hardware by purchasing products
from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
***************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);
void setup() {
Serial.begin(115200);
Serial.println(F("BME280 test"));
if (!bme.begin()) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");
Serial.println();
delay(2000);
}
Can anyone help me please to find the right I2C wiring ?
BR
Gawan