This example program utilizes the MAX31856 mbed library available from Maxim Integrated at the following link: https://os.mbed.com/teams/Maxim-Integrated/code/MAX31856/

Dependencies:   MAX31856 mbed

Fork of MAX31856_example_program by Central Applications - Mbed Code repo

main.cpp

Committer:
MI
Date:
2017-09-29
Revision:
14:88d5d2558149
Parent:
12:f3d87351cc34

File content as of revision 14:88d5d2558149:

#include "mbed.h"
#include "MAX31856.h"


// Hardware serial port over USB micro
Serial serial(USBTX, USBRX);

//SPI spi(SPIO MOSI,SPIO MISO,SPIO SCK);
SPI spi(P2_1, P2_2, P2_0);
//----------------------------------------------------------

//Thermocouples
MAX31856 Thermocouple(spi, P2_3);

DigitalOut led1(LED1);

int main() {

    
    float temperature_TC, temperature_CJ;
    
    while (true) {
        led1 = !led1;
        temperature_TC=Thermocouple.readTC();
        temperature_CJ=Thermocouple.readCJ();

        wait(0.2);

        serial.printf("MAX31856.CJ = %f C   MAX31856.TC = %f C\n\r",temperature_CJ,temperature_TC);  
    }
}