Y SI / Mbed OS lib_MAX31856_example

Dependencies:   lib_MAX31856

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "lib_MAX31856.h"
00003  
00004  
00005 // Hardware serial port over USB micro
00006 Serial serial(USBTX, USBRX);
00007  
00008 //SPI spi(SPIO MOSI,SPIO MISO,SPIO SCK);
00009 SPI spi(PTD2, PTD3, PTD1);
00010 //----------------------------------------------------------
00011  
00012 //Thermocouples
00013 MAX31856 Thermocouple(spi, PTD0);
00014  
00015 DigitalOut led1(LED1);
00016  
00017 int main() {
00018  
00019     
00020     float temperature_TC, temperature_CJ;
00021     
00022     while (true) {
00023         led1 = !led1;
00024         temperature_TC=Thermocouple.readTC();
00025         temperature_CJ=Thermocouple.readCJ();
00026  
00027         wait(0.2);
00028  
00029         serial.printf("MAX31856.CJ = %f C   MAX31856.TC = %f C\n\r",temperature_CJ,temperature_TC);  
00030     }
00031 }