c. Drawing Needles at Angles

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 08 - Drawing Needles >

c. Drawing Needles at Angles

This section shows how to draw needles at various angles using the NeedleXY() command.

 

 

Command Prototype

 

uint16_t NeedleXY(int X, int Y, int Length, int16_t Angle)

 

Parameters

Description

X, Y

(x,y) coordinates

Length

Needle Length

Angle

Angle at which the needle will be drawn

 

 

Code

 

 

void setup()

{

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

 CleO.begin();

 

 /* Start building a screen frame */

 CleO.Start();

 

/* Select needle width*/

 CleO.NeedleWidth(20);

 

/* Draw needles at different angles 0, 90, 180 and 270 */

 CleO.NeedleXY(160, 240, 200, 0);

 CleO.NeedleXY(160, 240, 170, 90);

 CleO.NeedleXY(160, 240, 200, 180);

 CleO.NeedleXY(160, 240, 170, 270);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet draws needles at various angles i.e. 0,90, 180 and 270.

The output indicates where the zero degree starts and increments clockwise.

 

 

Output

 

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

 

DrawingNeedlesAtAngles