mlx90614

wayland/mlx90614/mlx90614

MLX90614 temperature sensor.
mlx90614
@/mlx90614
MLX90614 temperature sensor.
I2Cxod/i2c/i2c
I²C bus.
ADDRbyte
I²C address of MLX90614 device.
UPDpulse
Update. Trigger a reading.
mlx90614
I2C
ADDR
UPD
AmbC
ObjC
DONE
DONEpulse
Pulse on read.
ObjCnumber
Temperature of the object in degrees Celsius.
AmbCnumber
Ambient temperature in degrees Celsius.
To use the node in your project you should have the wayland/mlx90614 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

// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/adafruit/Adafruit_BusIO"
#pragma XOD require "https://github.com/adafruit/Adafruit-MLX90614-Library"

//Include C++ libraries
#include <Wire.h>
#include <Adafruit_MLX90614.h>

node {
    meta {
        // Define our custom type as a pointer on the class instance.
        using Type = Adafruit_MLX90614*;
    }

    Adafruit_MLX90614 sensor = Adafruit_MLX90614();
    
    void evaluate(Context ctx) {

        if (isSettingUp()) {
           auto address = getValue<input_ADDR>(ctx);
           auto wire = getValue<input_I2C>(ctx);
            if (!sensor.begin(address, wire)) {
                raiseError(ctx);
                return;
            }
        }

        if (isInputDirty<input_UPD>(ctx)) {
            emitValue<output_AmbC>(ctx, sensor.readAmbientTempC());
            emitValue<output_ObjC>(ctx, sensor.readObjectTempC());
            emitValue<output_DONE>(ctx, 1);
        }
    }
}