I've been having trouble saving the printed data (co-ordinates and seconds) more than once when a key is pressed.
The aim is to try and save 'println' data to a file live and continuously while the programme is running.
At the moment, all I can seem to do is save data to a file until i press a key for the first time - then it stops recording,
Please help!
Richard
PrintWriter output;
void setup() {
// Create a new file in the sketch directory
output = createWriter("data_stream_time.txt");
}
void draw() {
point(mouseX, mouseY);
println (millis() / 1000);
println(mouseX + "t" + mouseY); // Write the coordinate to the file
output.println(mouseX + "t" + mouseY); // Write the coordinate to the file
output.println (millis() / 1000);
}
void keyPressed() {
output.flush(); // Writes the remaining data to the file
output.close(); // Finishes the file
redraw(); //redraws the programme when a letter is typed, flushes the data to the file
}
//only saves the first instance before you press a key. Afterwards it doesn't save!
Appologies if this is a simple question, although I haven't come across anything similar in my searches. A group of 3 of us have embarked on an ambitious Programming Arduino project with minimal training!
We're setting up a programme that will record user interaction in a room and we've got data printing to the serial port in processing but we're having trouble saving that information to a file, ideally saving it live as the programme is running.
How do we do this? I have found the examples and attempted to incorporate the saveStream and saveString and createWriter to the code but these don't save the information they just create the .txt file.
We're lead to believe it's pretty simple to save them in a .csv .txt. But at the moment we're having to make do copying and pasting the data into an excel file (obviously not ideal!).
Our code is getting very long so for now I'll spare the code, we'd just appreciate any examples of how to save the printed information.
A speedy response, even if we're barking up the wrong tree, would be very much appreciated.