max6675-thermo-amp

wayland/max6675-thermocouple-amplifier/max6675-thermo-amp

MAX6675 thermocouple amplifier
max6675-thermo-amp
@/max6675-thermo-amp
MAX6675 thermocouple amplifier
SCLKport
The Arduino pin connected to Clock.
CSport
The Arduino pin connected to Chip Select.
MISOport
The Arduino pin connected to Data Out.
UPDpulse
Update
max6675-thermo-amp
SCLK
CS
MISO
UPD
TempC
TempF
DONE
DONEpulse
Pulse on read of temperature.
TempFnumber
Temperature in degrees Fahrenheit.
TempCnumber
Temperature in degrees Celsius.
To use the node in your project you should have the wayland/max6675-thermocouple-amplifier 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/MAX6675-library"

//Include C++ libraries
#include <max6675.h>

node {
    meta {
        // Define our custom type as a pointer on the class instance.
        using Type = MAX6675*;
    }
    
    static_assert(isValidDigitalPort(constant_input_SCLK), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_CS), "must be a valid digitial port");
    static_assert(isValidDigitalPort(constant_input_MISO), "must be a valid digital port");

    MAX6675 thermocouple = MAX6675(constant_input_SCLK, constant_input_CS, constant_input_MISO);


    void evaluate(Context ctx) {

        if (isSettingUp()) {
            // wait for MAX chip to stabilize
            delay(500);
        }

        if (isInputDirty<input_UPD>(ctx)) {
            emitValue<output_TempC>(ctx, thermocouple.readCelsius());
            emitValue<output_TempF>(ctx, thermocouple.readFahrenheit());
            emitValue<output_DONE>(ctx, 1);
        }
    }
}