21 lines
538 B
Text
21 lines
538 B
Text
Table table;
|
|
|
|
float frequency=4; //data frequency in Hz
|
|
int duration=1000*10; //in ms
|
|
|
|
void setup() {
|
|
table = new Table();
|
|
table.addColumn("time"); // in milliseconds
|
|
table.addColumn("heartrate");
|
|
table.addColumn("random");
|
|
|
|
for (int i=0;i<(int)(duration/frequency);i++) {
|
|
TableRow newRow = table.addRow();
|
|
newRow.setInt("time", (int)(i*(1000/frequency)));
|
|
newRow.setFloat("heartrate", noise(i/10)*40.0+60);
|
|
newRow.setFloat("random", random(1));
|
|
}
|
|
|
|
saveTable(table, "data.csv");
|
|
println("Finished");
|
|
}
|