max31855k-device

antoniorrg/adafruit-max31855kdevice/max31855k-device

No description
max31855k-device
@/max31855k-device
MAXCLKnumber
Insert the CLK pin for the SPI communications (the 5 pin is used by default)
MAXCSnumber
Insert the CS pin for the SPI communications (the 4 pin is used by default)
MAXDOnumber
Insert the D0 pin for the SPI communications (the 3 pin is used by default)
UPDpulse
Node for updating the measurements
max31855k-device
MAXCLK
MAXCS
MAXDO
UPD
Temp
IntTemp
TempRead
DONE
DONEpulse
Pulses 1 when a measurement has been done
TempReadnumber
Test to check if the hardware is working correctly. Gives 1 if the reads give a numeric value, or 0 if something is wrong with the thermocouple.
IntTempnumber
Displays the internal temperature of the thermocouple (in oC)
Tempnumber
Displays the temperature (in oC)
To use the node in your project you should have the antoniorrg/adafruit-max31855kdevice 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/adafruit/Adafruit-MAX31855-library"
#pragma XOD require "https://github.com/adafruit/Adafruit_BusIO"
#include <SPI.h>
#include "Adafruit_MAX31855.h"


node {
    // Internal state variables defined at this level persists across evaluations
    Number foo;
    uint8_t bar = 5;

    void evaluate(Context ctx) {
        bar += 42;

        if (isSettingUp()) {
            // This run once
            foo = (Number)(bar + 1);
        }
  if (!isInputDirty<input_UPD>(ctx)) 
            return;
    
  int MAXCLK;
  int MAXCS;
  int MAXDO;
        
   MAXCLK = getValue<input_MAXCLK>(ctx);
   MAXCS = getValue<input_MAXCS>(ctx);
   MAXDO = getValue<input_MAXDO>(ctx);
        
   Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
  
   thermocouple.begin();

   double c = thermocouple.readCelsius();
   double r = thermocouple.readInternal()
        
   if (isnan(c)) {

   emitValue<output_TempRead>(ctx, 0);
    
   } else {

   emitValue<output_Temp>(ctx, c);
   emitValue<output_TempRead>(ctx, 1);

   emitValue<output_DONE>(ctx, 1);
       
   }
   emitValue<output_IntTemp>(ctx, r);
    }
      
}