mlx90614-1b

gcabral/mlx90614/mlx90614-1b

No description
mlx90614-1b
@/mlx90614-1b
INITpulse
Get Reading
mlx90614-1b
AmbientTempC
ObjectTempC
INIT
ObjectTempCnumber
AmbientTempCnumber
To use the node in your project you should have the gcabral/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

#pragma XOD require "https://github.com/gilcabral/Adafruit-MLX90614-Library-master-GC"
{{#global}}
#include <Adafruit_MLX90614.h>
{{/global}}


struct State {
    uint8_t mem[sizeof(Adafruit_MLX90614)];
};

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

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // It should be evaluated only once on the first (setup) transaction
    if (isSettingUp()){
    auto state = getState(ctx);
    Type MLX90614 = new (state->mem) Adafruit_MLX90614();
    MLX90614->begin();
    delay(100);
    }

    if (isInputDirty<input_INIT>(ctx)){
    auto state = getState(ctx);
    auto MLX90614 = reinterpret_cast<Adafruit_MLX90614*>(state->mem);
    emitValue<output_AmbientTempC>(ctx, MLX90614->readAmbientTempC());
    emitValue<output_ObjectTempC>(ctx, MLX90614->readObjectTempC());
    }
}