Reads carbon dioxide concentration (ppm), relative humidity (%) and temperature (°C).
read-data
@/read-data
Reads carbon dioxide concentration (ppm), relative humidity (%) and temperature (°C).
DEV@/scd30-device
An SCD30 device.
UPDpulse
Update. Triggers new read.
NO DATApulse
Pulses if no new data to read.
OKpulse
Pulses on successful read.
TEMPnumber
Temperature (°C).
RHnumber
Relative humidity (%).
CO2number
Carbon dioxide concentration (ppm).
To use the node in your project you should have the wayland/scd30-co2-rh-temp 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
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
// The node responds only if there is an input pulse
if (!isInputDirty<input_UPD>(ctx))
return;
// Get a pointer to the `SCD30` class instance
auto airSensor = getValue<input_DEV>(ctx);
if (airSensor->dataAvailable())
{
emitValue<output_CO2>(ctx,airSensor->getCO2());
emitValue<output_RH>(ctx,airSensor->getHumidity());
emitValue<output_TEMP>(ctx,airSensor->getTemperature());
emitValue<output_OK>(ctx,1);
} else {
emitValue<output_NO_DATA>(ctx, 1);
}
}