Daniel Blomdahl / Mbed 2 deprecated multiple_variable_temp

Dependencies:   MAX31855 SDFileSystem mbed

Committer:
DanielBlomdahl
Date:
Thu Mar 17 17:23:51 2016 +0000
Revision:
6:76e8649a643f
Parent:
3:9339e7b93415
Child:
7:9032b52be810
created readingData.h, giving the ability to reference measuring temp and voltage in main.cpp. Also added mountSDCard, openDataFile, etc functions into main. edited openDataFile on .h file for header row

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 6:76e8649a643f 4 #include "SDSaveFunction.h"
DanielBlomdahl 6:76e8649a643f 5 #include "readingData.h"
DanielBlomdahl 0:42e8fa13c7a9 6
DanielBlomdahl 2:a2966bf82e8c 7 Serial pc(USBTX,USBRX);
DanielBlomdahl 2:a2966bf82e8c 8 SPI spi(NC,PTD3,PTD1);
DanielBlomdahl 2:a2966bf82e8c 9
DanielBlomdahl 2:a2966bf82e8c 10 MAX31855 thermometer1(spi,PTC4);
DanielBlomdahl 2:a2966bf82e8c 11 MAX31855 thermometer2(spi,PTC3);
DanielBlomdahl 6:76e8649a643f 12 // solarpanel1(spi, whateverThePortIsForThis)
DanielBlomdahl 1:8116bd9d3c46 13 Timer t;
DanielBlomdahl 0:42e8fa13c7a9 14
DanielBlomdahl 0:42e8fa13c7a9 15 int main()
DanielBlomdahl 0:42e8fa13c7a9 16 {
DanielBlomdahl 1:8116bd9d3c46 17 float temp1, temp2;
DanielBlomdahl 1:8116bd9d3c46 18 float lastTime = 0;
DanielBlomdahl 1:8116bd9d3c46 19 float dt = 0.5;
DanielBlomdahl 1:8116bd9d3c46 20 t.start();
DanielBlomdahl 6:76e8649a643f 21 mountSDCard();
DanielBlomdahl 6:76e8649a643f 22 openDataFile();
DanielBlomdahl 6:76e8649a643f 23 while (halfHour<=6) {
DanielBlomdahl 6:76e8649a643f 24 if (t.read()>=30*60){
DanielBlomdahl 6:76e8649a643f 25 int halfHour++;
DanielBlomdahl 6:76e8649a643f 26 t.reset();
DanielBlomdahl 6:76e8649a643f 27 measureTemp(temp1);
DanielBlomdahl 6:76e8649a643f 28 measureVoltage
DanielBlomdahl 6:76e8649a643f 29 }
DanielBlomdahl 6:76e8649a643f 30 writeData((30*60*halfHour)+t.real(), temp1, voltage)
DanielBlomdahl 6:76e8649a643f 31 }
DanielBlomdahl 6:76e8649a643f 32 closeDataFile();
DanielBlomdahl 1:8116bd9d3c46 33 while (1) {
DanielBlomdahl 2:a2966bf82e8c 34 if (t.read()>lastTime+dt) {
DanielBlomdahl 2:a2966bf82e8c 35 lastTime = t.read();
DanielBlomdahl 1:8116bd9d3c46 36 temp1 = thermometer1.read();
DanielBlomdahl 1:8116bd9d3c46 37 temp2 = thermometer2.read();
DanielBlomdahl 6:76e8649a643f 38 volt = voltage.read(); // I will need to put the voltage reading in here.
DanielBlomdahl 2:a2966bf82e8c 39 wait(.5);
DanielBlomdahl 2:a2966bf82e8c 40 pc.printf("%1.3f \n\r", temp1);
DanielBlomdahl 6:76e8649a643f 41
DanielBlomdahl 2:a2966bf82e8c 42 }
DanielBlomdahl 2:a2966bf82e8c 43 }
DanielBlomdahl 0:42e8fa13c7a9 44 }