small line signal ili 9431

Hello everyone
i use an olimexino 328 plate and resistive tft 2.8 Adafruit

I read a sensor value and display it on the screen as a line, but the line is very small and I can not see the signal well. Is there any way I can increase the display of the signal?

picture in attache

thank you

void loop() {
//We begin by setting the LED off and reading the signal from the button and the potentimeter for the threshold
potVal = analogRead(potPin);

threshold = potVal -135;


//Next we set the default screen with ECG title and gridlines
//The following displays the ECG title above the grid
  tft.setRotation(1);
  tft.setCursor(100,0);
  tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2);
  tft.print("    EKG");
  tft.setRotation(0);

   


countScreen= countScreen+1;
sensorValue = analogRead(ECG);



//When the signal reaches the edge of the TFT screen the cursor is reset and the screen clears 
  if(countScreen > 320){
  countScreen = 0;//start screen at beginning
  previouspoint=20;
  tft.fillScreen(ILI9341_BLACK);
  drawGraph();
 
  }
  
//We translate the ECG and Threshold Values to heights on the screen
  int thresholdheight=map(threshold, 0, 1023, 0, 300);

//We draw lines for both signal between the previous point and the current point
  tft.drawLine(previousThreshold, countScreen-1, thresholdheight, countScreen, ILI9341_RED);
delay (0.000000001);
  previousThreshold=thresholdheight;//set previous threshold value

From the description of the problem it sounds like you would like to make the ECG line more visible on your display.

There are a few ways to do this, for example: thick lines, parallel lines (offset vertically) or plotting markers (eg. small rectangles/circles) at each new data point.

The most natural appearance for the graph may be from plotting thick lines between each data point. Unfortunately, drawing thick lines can be a little more involved than one might expect. One method to do this is to draw a filled quadrilateral at each segment (with a desired thickness centered along your line), but the graphics library may not support the filled quad function. Instead, a filled quadrilateral can be broken down (tessellated) into a pair of filled triangles (which the Adafruit library supports).

For example, we should be able to replace your:

tft.drawLine(LastX, LastY, CurX, CurY, Color);

With something like the following (untested) :

int nWidth=2;
tft.fillTriangle(LastX, LastY-nWidth, LastX, LastY+nWidth, CurX, LastY-nWidth, Color);
tft.fillTriangle(LastX, LastY+nWidth, CurX, CurY-nWidth, CurX, CurY+nWidth, Color);

The above assumes you want thickness in the Y axis, but I think your code might have swapped the axes so you may need to adjust accordingly.

A simpler method could be to draw a pair of parallel lines above and below your existing line, but that may not always look correct for steeper line segments.

Good luck!