-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAX31855_Logging.ino
60 lines (44 loc) · 1.56 KB
/
MAX31855_Logging.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
void thermocoupleLogData(){
slowFindName();
SdFile::dateTimeCallback(dateTime);
if (!file.open(fileName, O_CREAT | O_WRITE | O_EXCL)) { // We attemp to open the file
error("file.open");
DEBUGSERIAL.println(" Slow file.open error");
}
else{
long startTime = millis();
long lastSavingTime = millis();
float delayBetweenSave = 200 ; // in ms
// Aquisition("Thermo Logging",fileName); // Diplsay the screen of aquisition data
thermocoupleHeader();
while (!rightButtonPressed){
if ((millis()-lastSavingTime)>delayBetweenSave){
int status = thermocouple.read();
float tempTemp = thermocouple.getTemperature();
file.print(millis()-startTime);
file.print(";");
file.print(tempTemp);
file.println("");
if (!file.sync() || file.getWriteError()) {
error("write error");
DEBUGSERIAL.println(" Slow write error error");
}
lastSavingTime = millis();
ScreenThermocouple(true);
}
}
file.close();
ResetButton();
SlowSavingStats(fileName);
}
ResetButton();
}
void thermocoupleHeader() {
//Linear accel
file.print("File created on : ");
file.println(String(hour(),DEC)+ "h"+String(minute(),DEC)+ " - "+String(day(),DEC) + "/"+String(month(),DEC) + "/"+String(year(),DEC));
file.print("Time t (ms)");
file.print(";");
file.print("Temperature");
file.println("");
}