I want to change the x-axis scale of my 125x360 graph on the fly. To do this I plot for six minutes at one pixel a second while storing every fifth value in an array. At the end of six minutes, I clear the screen so that I can re-draw the graph using that data, and then carry on at five second intervals.
I can show the six-minute graph OK
myGLCD.setColor(0,250,200);
myGLCD.drawLine((pixKount-1),(125-int(oldiff*10)),pixKount, (125-int(diff*10)));
myGLCD.setColor(255,150,0);
myGLCD.drawLine((pixKount-1),(125-int(kW1*10)),pixKount, (125-int(kW*10)));
oldiff=diff;
kW1=kW;
and the same code is used OK for the second regular series at five second intervals.
I can accumulate the array OK
q = q+1; // q is the array count to 72
rises[q] = int (diff*10);
kWs[q] = int(kW*10);
With the following, I can regurgitate the array to the monitor OK but I can't draw the line. Something silly going on, I'm sure, but it complies OK.
void readArray()
{
Serial.println(" array ");
myGLCD.setColor(0,250,200);
for (int i=1; i<72; i++)
{
Serial.println(rises[i]); // just for testing!
myGLCD.drawLine((i+99),(125-(rises[i-1])),(i+100), (125-(rises[i])));
}
myGLCD.setColor(255,150,0);
for (int i=1; i<72; i++)
myGLCD.drawLine((i+99),(125-(kWs[i-1])),(i+100), (125-(kWs[i])));
}

