Daniel Blomdahl / Mbed 2 deprecated multiple_variable_temp

Dependencies:   MAX31855 SDFileSystem mbed

Committer:
DanielBlomdahl
Date:
Thu Mar 10 18:00:36 2016 +0000
Revision:
2:a2966bf82e8c
Parent:
1:8116bd9d3c46
Child:
3:9339e7b93415
Working code of just one thermocouple (thermometer 1). It only displays/prints data to Terminal. Does not save it to SD card.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DanielBlomdahl 2:a2966bf82e8c 1
DanielBlomdahl 0:42e8fa13c7a9 2 #include "mbed.h"
DanielBlomdahl 2:a2966bf82e8c 3 #include "MAX31855.h"
DanielBlomdahl 0:42e8fa13c7a9 4
DanielBlomdahl 2:a2966bf82e8c 5 Serial pc(USBTX,USBRX);
DanielBlomdahl 2:a2966bf82e8c 6 SPI spi(NC,PTD3,PTD1);
DanielBlomdahl 2:a2966bf82e8c 7
DanielBlomdahl 2:a2966bf82e8c 8 MAX31855 thermometer1(spi,PTC4);
DanielBlomdahl 2:a2966bf82e8c 9 MAX31855 thermometer2(spi,PTC3);
DanielBlomdahl 1:8116bd9d3c46 10 Timer t;
DanielBlomdahl 0:42e8fa13c7a9 11
DanielBlomdahl 0:42e8fa13c7a9 12 int main()
DanielBlomdahl 0:42e8fa13c7a9 13 {
DanielBlomdahl 1:8116bd9d3c46 14 float temp1, temp2;
DanielBlomdahl 1:8116bd9d3c46 15 float lastTime = 0;
DanielBlomdahl 1:8116bd9d3c46 16 float dt = 0.5;
DanielBlomdahl 1:8116bd9d3c46 17 t.start();
DanielBlomdahl 1:8116bd9d3c46 18
DanielBlomdahl 1:8116bd9d3c46 19 while (1) {
DanielBlomdahl 2:a2966bf82e8c 20 if (t.read()>lastTime+dt) {
DanielBlomdahl 2:a2966bf82e8c 21 lastTime = t.read();
DanielBlomdahl 1:8116bd9d3c46 22 temp1 = thermometer1.read();
DanielBlomdahl 1:8116bd9d3c46 23 temp2 = thermometer2.read();
DanielBlomdahl 2:a2966bf82e8c 24 wait(.5);
DanielBlomdahl 2:a2966bf82e8c 25 pc.printf("%1.3f \n\r", temp1);
DanielBlomdahl 2:a2966bf82e8c 26 }
DanielBlomdahl 2:a2966bf82e8c 27 }
DanielBlomdahl 0:42e8fa13c7a9 28 }