Hello,
I’m trying to make a cardiogram using the 2.8 TFT shield to display a graph
i’m encountering a problem: i don’t know how to continue to draw on the same line, is that possible ?
Here is my code:
[code]
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
int beat = 0;
int beat2 = 110;
void setup()
{
Serial.begin(9600);
TFT_BL_ON;
Tft.TFTinit();
}
void loop()
{
delay(50);
// Tft.drawLine(beat2,0,beat,0,GREEN);
beat = beat + 10;
Serial.print(“beat: “);
Serial.print(beat);
Serial.print(”\t”);
Serial.print("beat2: ");
Serial.println(beat2);
if (beat == 100){
beat2 = 150;
}
Tft.drawLine(110,0,beat2,beat,GREEN);
beat2 = 110;
if (beat == 320){
Serial.println(“reset !”);
beat = 0;
Tft.fillScreen(0, 240, 0, 320,BLACK);
}
}[/code]
It does to following:
/
/
/
/--------------------------
And i try to do the following:
/\ /\
--------/ \ /--------/ \ /------
\/ \/
Any idea ? i don’t want to redraw a new line but continue to draw on the same line, also did there is a better option to clear the screen instead of filling the screen with a black rectangle ?
Regards