Ebiroll / RAK811_BreakBoard

RAK811_BreakBoard for platformio from https://github.com/RAKWireless/RAK811_BreakBoard
23 stars 10 forks source link

BME280 support #4

Open SloMusti opened 6 years ago

SloMusti commented 6 years ago

I have seen you have added library support for BME280, however it does not appear to be included in main code that would read and report values. May I ask you for and details on that.

Also, Platform IO is reporting that obme280 library can not be located, although it is in the folder of the project as it should be.

Ebiroll commented 6 years ago

OK, I have added instructions, but all code is c so the extern "C" I talked about earlier probably will not help.

#include "OBME280.h"

// After MCUInit()
i2c_bme280_begin();

float temp=i2c_bme280_read_temp();
float pressure=i2c_bme280_read_pressure();
float rh=i2c_bme280_read_rh();
printf("RH %2f Temp %2f , pressure %2f\r\n",rh,temp,pressure);

To force new readings you should use, i2c_bme280_force_readings( );

Note that tis uses the same i2c as the MEMS sensor. The 3 bottom pins is GND, SCL, SDA