Create BMP280 device. See datasheet (https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMP280-DS001.pdf) for recommended oversampling and filter settings for specific use cases.
bmp280-device
@/bmp280-device
Create BMP280 device. See datasheet (https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMP280-DS001.pdf) for recommended oversampling and filter settings for specific use cases.
I2Cxod/i2c/i2c
I²C bus.
DEV@/bmp280-device
A BMP280 device.
To use the node in your project you should have the wayland/bmp280-barometer library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/adafruit/Adafruit_Sensor"
#pragma XOD require "https://github.com/adafruit/Adafruit_BMP280_Library"
#pragma XOD require "https://github.com/adafruit/Adafruit_BusIO"
//Include C++ libraries
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
node {
meta {
// Define our custom type as a pointer on the class instance.
using Type = Adafruit_BMP280*;
}
uint8_t mem[sizeof(Adafruit_BMP280)];
void evaluate(Context ctx) {
// It should be evaluated only once on the first (setup) transaction
if (!isSettingUp())
return;
auto wire = getValue<input_I2C>(ctx);
// Create an object of the class Adafruit_BMP280.
//Adafruit_BMP280 sensor = Adafruit_BMP280(wire);
Type sensor = new (mem) Adafruit_BMP280(wire);
emitValue<output_DEV>(ctx, sensor);
}
}