b. Drawing Needles with Parameters

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 08 - Drawing Needles >

b. Drawing Needles with Parameters

This section shows how to draw a needle with parameters like width, color, etc., using the commands Needle(), NeedleWidth() and NeedleColor().

 

 

Command Prototype

 

uint16_t Needle(int X1,int Y1,int X2,int Y2)

uint16_t NeedleWidth(int Width)

uint16_t NeedleColor(uint32_t argb)

 

Parameters

Description

X1 Y1

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

X2 Y2

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

Width

Needle Width

argb

Color values (for example - red, yellow, green etc.)

 

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);

 

/* Select needle color */

 CleO.NeedleColor(LIGHT_GREEN);

 

 /* Draw needle from (30, 30) to (800, 480) */

 CleO.Needle(30, 30, 800, 480);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet draws a needle from (30,30) to (800,480) with LIGHT_GREEN color.

 

 

Output

 

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

 

Tutorials08-NeedleParametersX1Y1X2Y2Color.50