bme680sensor

antoniorrg/bme680/bme680sensor

No description
bme680sensor
@/bme680sensor
IN@/bme680-device
Needs to connect with the self-ouput from the bme680-device node for initialisation
UPDpulse
Updates the pin
bme680sensor
IN
UPD
Temperature
Pressure
Humidity
Gas
DONE
DONEpulse
Pulses 1 when the node has been executed
Gasnumber
Outputs the gas concentration (in kOhm)
Humiditynumber
Outputs the humidity (in %)
Pressurenumber
Outputs the environmental Pressure (in hPa)
Temperaturenumber
Outputs the temperature (in oC)
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

node {
    // 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;
  
  int32_t  temp, humidity, pressure, gas;  // BME readings
  char     buf[16];                        // sprintf text buffer
  float    alt;                            // Temporary variable
  char buft[16];
  char bufh[16];
  char bufp[16];
  char bufg[16];
  int Num1;
  int Num2;
  int Num3;
  int Num4;
   
  auto BME680 = getValue<input_IN>(ctx);

  BME680->getSensorData(temp, humidity, pressure, gas); 
  
  temp = temp/100;
  emitValue<output_Temperature>(ctx, temp);
  humidity = humidity/1000;
  emitValue<output_Humidity>(ctx, humidity);
  pressure = pressure/100;
  emitValue<output_Pressure>(ctx, pressure);
  gas = gas/100;
  emitValue<output_Gas>(ctx, gas);
  emitValue<output_DONE>(ctx, 1);

}
}