To use the node in your project you should have the antoniorrg/bme680 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
#pragma XOD require "https://github.com/SV-Zanshin/BME680"
#include <Zanshin_BME680.h>
#include <Adafruit_Sensor.h>
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
node {
meta {
// Define our custom type as a pointer on the class instance.
using Type = BME680_Class*;
}
// Create an object of class Adafruit_TSL2591
BME680_Class BME680 = BME680_Class();
// Internal state variables defined at this level persists across evaluations
Number foo;
uint8_t bar = 5;
void evaluate(Context ctx) {
bar += 42;
if (isSettingUp()) {
// This run once
foo = (Number)(bar + 1);
}
if (!isInputDirty<input_UPD>(ctx))
return;
Number Test = 6;
uint8_t IIC_ADDR;
IIC_ADDR = getValue<input_ADDR>(ctx);
while(!BME680.begin(IIC_ADDR)){
Test = 16;
}
BME680.begin(IIC_ADDR);
BME680.setOversampling(TemperatureSensor, Oversample16); // Use enumerated type values
BME680.setOversampling(HumiditySensor, Oversample16); // Use enumerated type values
BME680.setOversampling(PressureSensor, Oversample16); // Use enumerated type values
BME680.setIIRFilter(IIR4);
BME680.setGas(320, 150); // 320�c for 150 milliseconds
emitValue<output_OUT>(ctx, &BME680);
}
}