max31855

wayland/max31855/max31855

MAX31855 Thermocouple Amplifier
max31855
@/max31855
MAX31855 Thermocouple Amplifier
SCLKport
Pin to use for SPI Serial Clock.
CSport
Pin to use for SPI Chip Select.
MISOport
Pin to use for SPI Master In Slave Out.
UPDpulse
Update. Trigger read.
max31855
SCLK
CS
MISO
UPD
tempC
DONE
DONEpulse
Pulse on read.
tempCnumber
Temperature in degrees Celsius.
To use the node in your project you should have the wayland/max31855 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-MAX31855-library"

//Include C++ libraries
#include <SPI.h>
#include <Adafruit_MAX31855.h>

node {

    meta {
        using Type = Adafruit_MAX31855*;
    }
    
    static_assert(isValidDigitalPort(constant_input_SCLK), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_CS), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_MISO), "must be a valid digital port");

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

    void evaluate(Context ctx) {

        if (isSettingUp()) {
            if (!thermocouple.begin()) {
                raiseError(ctx);
                return;
            }
        }
        
        if (isInputDirty<input_UPD>(ctx)) {
            emitValue<output_tempC>(ctx, thermocouple.readCelsius());
            emitValue<output_DONE>(ctx, 1);
        }
    }
}