Just cleaned it up a little, and added some extra float values so I could use more than one at any one time.
float myTime;
float mySpeed;
float myHeart;
int index; // The global index variable
String[] time;
String[] heart;
String[] speed;
void setup(){
size (1200, 1000);
smooth();
frameRate(15);
time = loadStrings(“time.csv”);
heart = loadStrings(“heart_rate.csv”);
speed = loadStrings(“speed.csv”);
}
void draw(){
fill (255, 7);
rect (0, 0, width, height);
mySpeed = 10 * (new Float(speed[index]));
myTime = 10 * (new Float(time[index]));
myHeart = 10 * (new Float(time[index]));
noFill();
fill (myHeart, 100, myHeart);
rect(index * 10, mySpeed * 6, myHeart * 6, myHeart * 1);
ellipse(index * 10, myTime * 20, myTime * 5, myTime * 5);
index = index +1; // Check when reaching 120, stop or restart at 0
if (index > 119) {
index = 0;
}
noFill();
}













Recent Comments