TFT - line()

Description

Draws a line between two points. Use stroke() to change the color of something drawn with line().

Syntax

screen.line(xStart, yStart, xEnd, yEnd);

Parameters

xStart : int, the horizontal position where the line starts yStart : int, the vertical position where the line starts xEnd : int, the horizontal position where the line ends yEnd : int, the vertical position where the line ends

Returns

none

Example

#include <SPI.h>
#include <TFT.h>            // Arduino TFT library

#define cs   10
#define dc   9
#define rst  8

TFT screen = TFT(cs, dc, rst);

void setup() {
  // initialize the screen
  screen.begin();

  // make the background black
  screen.background(0,0,0);

  // set the stroke color to white
  screen.stroke(255,255,255);

  // draw a diagonal line across the screen's center
  screen.line(0, 0, 160, 124);
}

void loop() {

}