a. Drawing Lines between Two Points

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 04 - Drawing Lines >

a. Drawing Lines between Two Points

This section shows how to draw a line between two points using the Line() command.

 

 

Command Prototype

 

uint16_t Line(int X1, int Y1, int X2, int Y2);

 

Parameters

Description

X1, Y1

(x1,y1) coordinate, start point of the line

X2, Y2

(x2,y2) coordinate, end point of the line

 

 

Code

 

 

void setup()

{

 /* Initialize CleO - needs to be done only once */

 CleO.begin();

 

/* Start building a screen frame */

 CleO.Start();

 

/* draw a line on screen connecting two points (10, 10) & (790, 470) */

 CleO.Line(10, 10, 790, 470);

 

 /* Display completed screen frame */

 CleO.Show();

}

 

void loop() { }

 

 

Description

 

The above code snippet draws a line that starts at (10, 10) and ends at (790, 470).

 

 

Output

 

Here is the output displayed upon executing the above code snippet -

 

Tutorials04-DrawingLineX1Y1X2Y2.50