Lab_interaccio/2016/Monitor_Bateria/SDUpdate.ino

78 lines
1.1 KiB
Arduino
Raw Normal View History

2025-02-25 21:29:42 +01:00
void txSD() {
Serial.println("*** txSD ***");
// if the file opened okay, write to it:
if (myFile = SD.open("post.csv", FILE_WRITE)) {
#if debuggEnabled
Serial.println(F("Writing..."));
#endif
myFile.print(SENSORvalue[0]);
myFile.print(",");
myFile.print(sckRTCtime());
myFile.println();
// close the file:
myFile.close();
#if debuggEnabled
Serial.println(F("Closing..."));
#endif
}
}
char* SENSOR[10]={
"Temperature",
"Humidity",
"Light",
"Battery",
"Solar Panel",
"Carbon Monxide",
"Nitrogen Dioxide",
"Noise",
"Wifi Spots",
"UTC"
};
char* UNITS[10]={
#if F_CPU == 8000000
#if DataRaw
" C RAW",
" % RAW",
#else
" C",
" %",
#endif
#else
" C",
" %",
#endif
#if F_CPU == 8000000
" lx",
#else
" %",
#endif
" %",
" V",
" kOhm",
" kOhm",
#if DataRaw
" mV",
#else
" dB",
#endif
"",
""
};
void updateSensorsSD() {
SENSORvalue[0] = average(S0)*Vcc/1023.*3;
}
void txDebugSD() {
Serial.println("*** txDebugSD ***");
Serial.print(SENSORvalue[0]);
Serial.println(" mV");
Serial.println(sckRTCtime());
Serial.println(F("*******************"));
}