read-air-quality

gabbapeople/mp503-air-quality-sensor/read-air-quality

No description
read-air-quality
@/read-air-quality
DEV@/mp503-device
UPDpulse
read-air-quality
DEV
UPD
DEV'
AQ
DONE
DONEpulse
AQnumber
DEV'@/mp503-device
To use the node in your project you should have the gabbapeople/mp503-air-quality-sensor 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) {
    auto sensor = getValue<input_DEV>(ctx);
    emitValue<output_DEVU0027>(ctx, sensor);

    if (!isInputDirty<input_UPD>(ctx))
        return;

    uint8_t quality = sensor->slope();
    emitValue<output_AQ>(ctx, quality);
    emitValue<output_DONE>(ctx, 1);

}