Dear friends,
I tried the following code to interface BMP280 (improved version of BMP180) with Wemos (ESP8266) but am unsuccessful. The attached library for arduino with a sketch works ok.
Please help.
I tried the following code to interface BMP280 (improved version of BMP180) with Wemos (ESP8266) but am unsuccessful. The attached library for arduino with a sketch works ok.
B4X:
Sub Process_Globals
Public Serial1 As Serial
Public TEMPERATURE, PRESSURE As Double
Private Timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
RunNative("setup",Null)
Timer1.Initialize("Timer1_Tick", 500)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick
RunNative("read",Null)
Log(TEMPERATURE)
Log(PRESSURE)
End Sub
#if C
#include "BMP280.h"
#include "Wire.h"
#define P0 1013.25
BMP280 bmp;
void setup(B4R::Object* o){
bmp.setOversampling(4);
}
void read (B4R::Object* o) {
char result = bmp.startMeasurment();
result=bmp.getTemperatureAndPressure(b4r_main::_temperature,b4r_main::_pressure);
}
#End if
Please help.