I have an STM32F103 (blue pill) and i want to connect with a BME280 sensor in order to develop a project.
I want to read temperature , humidity and pressure from the sensor.
I use I2C protocol for my sensor.
After some search i found that the sensor could connect to B8,B9 of the STM module (B8---SDA , B9---SCL)
I used Adafruit BME280 library.
But since now i can not get data from sensor.I get only zeros.
The project compiles OK with no errors.
I use Arduino IDE .
Here is my sample code:
Code: Select all
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
void setup()
{
Serial.begin(115200);
bme.begin();
}
void loop()
{
Serial.println(bme.readTemperature(),1);
Serial.println(bme.readHumidity(),1);
Serial.println(bme.readPressure(),1);
delay(1000);
}