Hallo all,
I'm trying to do something that seems to me as rather simple, but I'm struggling to make it work.
The sketch should write a file to the Linux machine, where it will be handled by a Python script that will delete the file when it's done. To prevent the file to be overwritten every now and than, I want to generate a rather unique filename using for instance the millis() function. This turns over ever 50 days or so, and this should be more than enough.
What I tried to do is something like this:
void SendToPython(){
Process p;
char t[] = {millis()}; // Should be used to make the filename unique,
// by replacing 'TestFile' with this number.
char f[] = {"/SPOOL/INPUT/msg_TestFile.txt"};
// Create a new file
Serial.println("Creating file");
File dataFile = FileSystem.open(f , FILE_WRITE);
if (dataFile) {
dataFile.print("Write some string to the file");
}
dataFile.close();
}
else { // if the file isn't open, pop up an error:
Serial.println("Error opening messagefile in '/SPOOL/INPUT/'");
}
// Ensure the last bit of data is sent.
Serial.flush();
Serial.println("__________________________end message____________________________ ");
}
As long as I create the file with the char-string as I do above, all is fine.
When I try to insert the value of millis() into the string, in all possible ways I could imagine, I keep getting conversion errors.
How could I handle this the best please?
Friendly greetings,
Rens