Make graph timestep slow

edited April 2015 in Questions about Code

Hello everyone. As many Arduino enthusiasts, I cross the bridge to Processing. Its something good, really, but my lacks of C++ block me: On SerialCallResponse, I'd like to have the graph data updated every 30secondes, while the bargraph will run a normal speed ( dependent of frameRate or Serial speed).

              void draw() {
                      background(180,180,240);
                     digitalClock.getTime();
                     digitalClock.display();

            //first graph
                stroke(0);
                fill(200,200,200);
                rect(100,275,300,20);  
            //data points
            if((millis()-lasttime)>500){
                 for(int index =0; index<200; index++)
                 {                     
                  if(index == 199){
                    tempHistory0[index] = t0;
                  }     
                  else{
                    tempHistory0[index] = tempHistory0[index + 1];
                    point(100 + index, 275 - tempHistory0[index]);  
                      lasttime = millis(); 
                        }        
                  }
                 }  
            }

In this case, the points a recorded every 500ms, but blinks, the rectangle on background erase it. Data from serial are bytes stored in an array. I tried many combinations but cannot find the right on. Its a simple coding question from a beginner. Greetings.

Answers

Sign In or Register to comment.