How can I constantly save variables in tables as the program runs?

Hi, I am using saveTable() function in my code and the problem I am getting is that my table is constantly saved after every 20 seconds but after about 400 rows I start to get rows with only zeros…I am really confused…regarding it …could it be because of the reason that I am not closing the output file by using exit() function in my code

1 Like

Hi,

Welcome to the comunity! :slight_smile:

Can you show us a bit of code (by using the </> button) to show how and when you save your table?

3 Likes

I have a timer function in the code like this one

Table table;
double counter=millis();
void timer(){
  if(millis()>counter+10000){ // means after 10 seconds
    saveTable(table,"data/new.csv");
  }
}

the program works fine for 4000 entries and after that the proceeding rows only have zeros

1 Like

You overwrite the table.

You can as well save after 1 minute or so

Try it

Maybe the error is elsewhere in your Sketch

2 Likes