Hi,
I’m trying to read the data from my BMP280 sensor but it doesn’t works
I’m waiting for your help
my code:
#include "Arduino.h" #include <Wire.h> #include <BMP280.h> uint8_t confirmedNbTrials = 4; float temperature, humidity, pressure, lux, co2, tvoc; uint16_t baseline; int count; int maxtry = 50; BMP280 bmp; void setup() { Serial.begin(9600); Wire.begin(); pinMode(Vext, OUTPUT); digitalWrite(Vext, LOW); delay(500); count = 0; bmp.begin(); delay(500); bmp.setSampling(BMP280::MODE_NORMAL, /* Operating Mode. */ BMP280::SAMPLING_X2, /* Temp. oversampling */ BMP280::SAMPLING_X16, /* Pressure oversampling */ BMP280::FILTER_X16, /* Filtering. */ BMP280::STANDBY_MS_500); /* Standby time. */ float temp = bmp.readTemperature(); pressure = (float)bmp.readPressure() / 100.0; Wire.end(); while (pressure > 1190.0 && count < maxtry) { bmp.begin(); delay(500); bmp.setSampling(BMP280::MODE_NORMAL, /* Operating Mode. */ BMP280::SAMPLING_X2, /* Temp. oversampling */ BMP280::SAMPLING_X16, /* Pressure oversampling */ BMP280::FILTER_X16, /* Filtering. */ BMP280::STANDBY_MS_500); /* Standby time. */ pressure = (float)bmp.readPressure() / 100.0; Wire.end(); count++; delay(500); } if (pressure > 1190.0) { pressure = 0; Serial.println("BMP ERROR"); } Wire.end(); digitalWrite(Vext, HIGH); uint16_t batteryVoltage = getBatteryVoltage(); unsigned char *puc; Serial.print("T="); Serial.print(temperature); Serial.print("C, RH="); Serial.print(humidity); Serial.print("%, Lux="); Serial.print(lux); Serial.print(" lx, Pressure="); Serial.print(pressure); Serial.print(" hPA, CO2="); Serial.print(co2); Serial.print(" ppm, TVOC="); Serial.print(tvoc); Serial.print(" ppb, Baseline: "); Serial.print(baseline); Serial.print(", BatteryVoltage:"); Serial.println(batteryVoltage); } void loop() { }