Hallo,
Es geht um einen einfachen SD Datelogger. Nur habe ich das Problem ,dass die Messung immer nach 120kb oder 3819 Zeilen abbricht bzw. nicht mehr Datenloggt.
In der Suchfunze habe ich nichts gefunden. Bzw. Memory Overflow ??
Danke schon mal im Voraus
#include <SD.h>
#define chipSelect 53
#define led 13
#define Temperatur A14
#define Input1 A2
#define Input2 A3
#define Input3 A4
char charTmp[10]="",charWert1[10]="",charWert2[10]="",charWert3[10]="",charWert4[10]="";
double constant=0;
const double ref = 0.004888,Tempkoeff=50.400,V=0.3333;
unsigned long timeStart;
File dataFile;
void setup()
{
// Serial.begin(115200);
constant=ref*Tempkoeff*V;
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
SDInit();
if(!SD.begin(chipSelect)) digitalWrite(led,HIGH);
timeStart=millis();
}
void loop()
{
//if (millis()-timeStart>3000){
// timeStart=millis();
double IstTemp=analogRead(Temperatur)*constant-19.3;
Logging(millis()*0.001,IstTemp,analogRead(Input1)*ref,analogRead(Input2)*ref,analogRead(Input3)*ref);
}
//}
void Logging (unsigned long time,double tmp,double Wert1,double Wert2,double Wert3){
char dataString[100] = "";
dtostrf(tmp,6,3,charTmp);
dtostrf(Wert1,6,3,charWert1);
dtostrf(Wert2,6,3,charWert2);
dtostrf(Wert3,6,3,charWert3);
sprintf(dataString,"%lu:%s:%s:%s:%s",time,charTmp,charWert1,charWert2,charWert3);
dataFile = SD.open("Test.txt", FILE_WRITE);
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
//Serial.println(dataString);
}
}
void SDInit(){
pinMode(chipSelect, OUTPUT);
pinMode(48, OUTPUT);
digitalWrite(48,HIGH);
}