I am now trying the BMP280 example (tried getting temp via Dallas Temp 18B20 before, which failed, so trying out this sensor). I connected to VDD and GND, SCL / SDA - just to make sure EXT is not an issue.
Below my basic code, but it returns 0 for temp and humidity…
I think there might even be a bigger issue with 1.0.0 of the CubeCell framework, lot’s of methods written in uppercase and the example code not compiling initiallly… I cannot believe I am the only one having these issues.
thx for your help!
#include "Arduino.h"
#include <Wire.h>
#include <BMP280.h>
float Temperature, Humidity;
int count;
int maxtry = 50;
BMP280 bmp;
void temp()
{
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();
float 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);
Serial.print("T=");
Serial.print(Temperature);
Serial.print("C, RH=");
Serial.println(Humidity);
}
void setup() {
boardInitMcu( );
Serial.begin(115200);
}
void loop()
{
temp();
delay(1000);
}