Example with lib_MAX31856

Dependencies:   lib_MAX31856

Committer:
YSI
Date:
Fri Jul 23 08:16:54 2021 +0000
Revision:
0:b7129255870b
up lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YSI 0:b7129255870b 1 #include "mbed.h"
YSI 0:b7129255870b 2 #include "lib_MAX31856.h"
YSI 0:b7129255870b 3
YSI 0:b7129255870b 4
YSI 0:b7129255870b 5 // Hardware serial port over USB micro
YSI 0:b7129255870b 6 Serial serial(USBTX, USBRX);
YSI 0:b7129255870b 7
YSI 0:b7129255870b 8 //SPI spi(SPIO MOSI,SPIO MISO,SPIO SCK);
YSI 0:b7129255870b 9 SPI spi(PTD2, PTD3, PTD1);
YSI 0:b7129255870b 10 //----------------------------------------------------------
YSI 0:b7129255870b 11
YSI 0:b7129255870b 12 //Thermocouples
YSI 0:b7129255870b 13 MAX31856 Thermocouple(spi, PTD0);
YSI 0:b7129255870b 14
YSI 0:b7129255870b 15 DigitalOut led1(LED1);
YSI 0:b7129255870b 16
YSI 0:b7129255870b 17 int main() {
YSI 0:b7129255870b 18
YSI 0:b7129255870b 19
YSI 0:b7129255870b 20 float temperature_TC, temperature_CJ;
YSI 0:b7129255870b 21
YSI 0:b7129255870b 22 while (true) {
YSI 0:b7129255870b 23 led1 = !led1;
YSI 0:b7129255870b 24 temperature_TC=Thermocouple.readTC();
YSI 0:b7129255870b 25 temperature_CJ=Thermocouple.readCJ();
YSI 0:b7129255870b 26
YSI 0:b7129255870b 27 wait(0.2);
YSI 0:b7129255870b 28
YSI 0:b7129255870b 29 serial.printf("MAX31856.CJ = %f C MAX31856.TC = %f C\n\r",temperature_CJ,temperature_TC);
YSI 0:b7129255870b 30 }
YSI 0:b7129255870b 31 }