get-resolution

wayland/mcp9808-thermometer/get-resolution

Get resolution mode of device. MCP9808 has four resolution modes (resolution and sample time in parentheses): 00h ( 0.5°C , 30 ms); 01h (0.25°C, 65 ms); 02h (0.125°C, 130 ms); 03h (0.0625°C, 250 ms).
get-resolution
@/get-resolution
Get resolution mode of device. MCP9808 has four resolution modes (resolution and sample time in parentheses): 00h ( 0.5°C , 30 ms); 01h (0.25°C, 65 ms); 02h (0.125°C, 130 ms); 03h (0.0625°C, 250 ms).
DEV@/mcp9808-device
A MCP9808 device.
UPDpulse
Update. Trigger read of device resolution.
get-resolution
DEV
UPD
RESOLUTION
DONE
DONEpulse
Pulse on completion.
RESOLUTIONbyte
Resolution mode. Should be one of the following four values: Mode Resolution Sample time 00h 0.5°C 30 ms 01h 0.25°C 65 ms 02h 0.125°C 130 ms 03h 0.0625°C 250 ms
To use the node in your project you should have the wayland/mcp9808-thermometer 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 `Adafruit_MCP9808` class instance
    auto sensor = getValue<input_DEV>(ctx);
    emitValue<output_RESOLUTION>(ctx, sensor->getResolution());
    emitValue<output_DONE>(ctx, 1);
}