2021-11-11 10:03:30 +00:00
|
|
|
Table table;
|
|
|
|
|
|
|
|
float frequency=4; //data frequency in Hz
|
2022-05-05 10:45:39 +00:00
|
|
|
int duration=10; //in s
|
2021-11-11 10:03:30 +00:00
|
|
|
|
|
|
|
void setup() {
|
|
|
|
table = new Table();
|
|
|
|
table.addColumn("time"); // in milliseconds
|
|
|
|
table.addColumn("heartrate");
|
|
|
|
table.addColumn("random");
|
|
|
|
|
2022-05-05 10:45:39 +00:00
|
|
|
for (int i=0;i<(int)(duration*frequency);i++) {
|
2021-11-11 10:03:30 +00:00
|
|
|
TableRow newRow = table.addRow();
|
2022-05-05 10:45:39 +00:00
|
|
|
newRow.setFloat("time", (float)(i/frequency));
|
2021-11-11 10:03:30 +00:00
|
|
|
newRow.setFloat("heartrate", noise(i/10)*40.0+60);
|
|
|
|
newRow.setFloat("random", random(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
saveTable(table, "data.csv");
|
|
|
|
println("Finished");
|
|
|
|
}
|