change time to seconds

This commit is contained in:
Philipp Kramer 2022-05-05 12:45:39 +02:00
parent 900b38e2cd
commit 669aeca055
4 changed files with 87 additions and 80007 deletions

View file

@ -1,7 +1,7 @@
Table table;
float frequency=4; //data frequency in Hz
int duration=1000*10; //in ms
int duration=10; //in s
void setup() {
table = new Table();
@ -9,9 +9,9 @@ void setup() {
table.addColumn("heartrate");
table.addColumn("random");
for (int i=0;i<(int)(duration/frequency);i++) {
for (int i=0;i<(int)(duration*frequency);i++) {
TableRow newRow = table.addRow();
newRow.setInt("time", (int)(i*(1000/frequency)));
newRow.setFloat("time", (float)(i/frequency));
newRow.setFloat("heartrate", noise(i/10)*40.0+60);
newRow.setFloat("random", random(1));
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,8 +10,8 @@ Table data;
TableRow datarow;
int rowid=0;
long time=0;
long starttime=0;
float time=0;
float starttime=0;
public enum Playmode {
STOP, LOOP;
@ -42,7 +42,7 @@ void setup() {
void draw() {
time=millis()-starttime;
time=millis()/1000.0-starttime;
datarow = data.getRow(rowid);
background(0);
@ -97,7 +97,7 @@ void draw() {
void restart() {
play=true;
starttime=millis();
starttime=millis()/1000.0;
rowid=0;
}