TFT Plotting


hi,

i use code plot readings on tft display (480x800). works great, have problem. when plot first reading, drawline starts y 0 (x 51, y 0) on display, , plots next readings within screensize set.

anybody knows how fix this?

thanks,

the code:

void loop() {

  {

    int a1, a2, b1, b2, c1, c2;


    int color1 = c1; // green
    int color2 = c2; // yellow
    int color3 = c3; // red
    int color4 = c4; // blue
    int color5 = c5; // cyan
    int color6 = c6; // purple



    (int x = 51; x < 800; x++)  {


      a2 = map(analogread(a0), 0, 1023, 149, 40); // map max analog read (1023) max screensize (240)
      b2 = map(analogread(a1), 0, 1023, 299, 190); // map max analog read (1023) max screensize (240)
      c2 = map(analogread(a2), 0, 1023, 449, 340); // map max analog read (1023) max screensize (240)

      tft.drawline(x, a1, x + 1, a2, color6); // draw line between previous reading , current
      tft.drawline(x, b1, x + 1, b2, color4); // draw line between previous reading , current
      tft.drawline(x, c1, x + 1, c2, color3); // draw line between previous reading , current
     
      a1 = a2; // make current reading previous
      b1 = b2;
      c1 = c2;

    }
  }
}

code: [select]
tft.drawline(x, a1, x + 1, a2, color6); // draw line between previous reading , current

yes, that's told do.  start @ x (which 51) , a1 (which never gave value , happened end 0).   try giving a1 initial value think should have.  compiler isn't going guess it. 


Arduino Forum > Using Arduino > Displays > TFT Plotting


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts