Time in Processing

millis is a very short Periode of time: 1/1000 sec

Draw() runs only 60 times per second

This means if you do an if comparison in draw() each iteration of draw, already hundreds of milliseconds have passed!!!

Hence a comparison against your data set using == is worthless

Instead use if(millis() >= previousTimeFromDataSet && millis() < timeFromDataSet) …

OR

You indeed read your data set line by line and ignore the millis in this process

Then when you plot the next point in your graph (or draw a line to the next point) :

See the x axis as time that has passed and the y axis as the speed at this time

Calculate the x and the y value using map() - see reference

x = map(timeFromDataSet, 0, 12000, 0, width);

y = map(speed, 0,310,height-20, 0);

or something similar

Chrisir

1 Like