c. Drawing Lines at Angles

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 04 - Drawing Lines >

c. Drawing Lines at Angles

This section shows how to draw a line at an angle using the LineAngle() and LineXY() command.

 

 

Command Prototype

 

uint16_t LineXY(int X, int Y, int Length);

 

Parameters

Description

X, Y

(x,y) coordinate,  starting point of the line

Length

Line length

 

 

uint16_t LineAngle()

 

Parameters

Description

Angle

Angle of the line

 

 

Code

 

 

void setup()

{

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

   CleO.begin();

 

  /* Start building a screen frame */

   CleO.Start();

 

  /* select different line angles and draw line at (150, 240) with 150 length */

   CleO.LineAngle(60);

   CleO.LineXY(150, 240, 150);

   CleO.LineAngle(120);

   CleO.LineXY(150, 240, 150);

   CleO.LineAngle(180);

   CleO.LineXY(150, 240, 150);

   CleO.LineAngle(240);

   CleO.LineXY(150, 240, 150);

   CleO.LineAngle(300);

   CleO.LineXY(150, 240, 150);

   CleO.LineAngle(360);

   CleO.LineXY(150, 240, 150);

 

 /* Display completed screen frame */

   CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet draws lines at (150,240). For each line, the degree of angle changes by 60 degrees.

 

 

Output

 

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

 

DrawingLinesAtAngles