GLCD Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld

GLCD Shield allows you to use your smartphone display screen as a graphical LCD screen for Arduino., so you can draw characters or interactive shapes with Arduino code. Learn more from the examples page.

This shield is one of the special shields. Special shields allows your Arduino board to use some capabilities your smartphone can do, like playing music, taking a picture, getting notifications, accessing the clock data and using the touch screen for various functions. Learn more from the special shields tutorial.

 

Description

GLCD Shield turns your Smartphone’s Screen into a (256 x 128 points) that allows you to draw passive and interactive shapes “Lines, Circles, Progress Bars etc.” to display your ideas, data and even make animations.

Adding #define CUSTOM_SETTINGS along with #define INCLUDE_GLCD_SHIELD is a key that will let you unlock the GLCD shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.

Note :

– GLCD origins is set at the up left corner of the display.

 

 void clear(void)

Clears the GLCD

SYNTAX

GLCDShield.clear();

RETURNS

None.

PARAMETERS

None.

USAGE

GLCDShield.clear();

 

 void draw(ShapeClass&)

Draws the shape created on the GLCD.

SYNTAX

GLCD.draw(shapeObject);

RETURNS

None.

PARAMETERS

Takes a shape name created.

USAGE

GLCDPoint point(0,0);
GLCD.draw(point);

 

GLCDAnalogGauge(int,int,int)

Creates an analog gauge and simulates values.(default 0 to 100).

SYNTAX

GLCDAnalogGauge anGauge(x1Position,y1Position,radius);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : radius.

USAGE

GLCDAnalogGauge anGauge(128,64,50);

 

void setRange(int , int)

Sets range of values to the created analog gauge.

SYNTAX

anGauge.setRange(start,end);

RETURNS

None.

PARAMETERS

1st parameter : start value.

2nd parameter : end value.

USAGE

anGauge.setRange(0,200);

 

void setValue(int )

Sets the value to be simulated on the analog gauge.

SYNTAX

anGauge.setValue(value);

RETURNS

None.

PARAMETERS

Value to be simulated on the analog gauge.

USAGE

anGauge.setValue(50);

 

void setRadius(int)

Change the radius of the analog gauge.

SYNTAX

anGauge.setRadius(radiusValue);

RETURNS

None.

PARAMETERS

Radius value of the gauge.

USAGE

anGauge.setRadius(100);

 

void setVisibility(bool)

Makes the analog gauge visible or invisible.

SYNTAX

anGauge.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

anGauge.setVisibility(true);

 

void setPosition(void)

Reset the position of the created analog gauge.

SYNTAX

anGauge.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

anGauge.setPosition(100,100);

 

GLCDButton(int , int , int ,int ,char *)

Creates a button to perform tasks.

SYNTAX

GLCDButton button(x1Position,y1Position,width,height,ButtonName);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : width.

4th parameter: height.

5th parameter: button name.

USAGE

GLCDButton button(128,64,50,50,"1Sheeld");

 

GLCDButton(int , int , int ,int)

Creates a button to perform tasks.

SYNTAX

GLCDButton button(x1Position,y1Position,width,height);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : width.

4th parameter: height.

USAGE

GLCDButton button(128,64,50,50);

 

bool isPressed(void)

Checks if button has been pressed.

SYNTAX

button.isPressed( );

RETURNS

A True or False of button state.

PARAMETERS

None.

USAGE

bool isButtonPressed = false;
isButtonPressed = button.isPressed();

 

void setText(char *)

Changes the name of the button.

SYNTAX

button.setText(buttonNewName);

RETURNS

None.

PARAMETERS

Take button name in char array.

USAGE

button.setText(”1Sheeld”);

 

void setStyle(byte )

Sets the style of the button. (default = 2D)

LITERAL:

STYLE_2D                                         

STYLE_3D       

SYNTAX

button.setStyle(LITERAL);

RETURNS

None.

PARAMETERS

Takes one of the given literals declared above.

USAGE

button.setStyle(STYLE_3D);

 

void setDimensions(int,int)

Resize the button by setting its dimensions.

SYNTAX

button.setDimensions(width,height);

RETURNS

None.

PARAMETERS

1st parameter: new width.

2nd parameter: new height.

USAGE

button.setDimensions(100,20);

 

void setOnChange(void(*userFunction)(byte))

Sets a certain user function to be invoked once the button is pushed.

SYNTAX

button.setonChange(&userFunction);

RETURNS

None.

PARAMETERS

Take and address to the user function to be invoked once the button is pressed.

USAGE

button.setOnChange(&userFunction);

 

void setVisibility(bool)

Makes the button visible or invisible.

SYNTAX

button.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

button.setVisibility(true);

 

void setPosition(int,int)

Reset the position of the button.

SYNTAX

button.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

GLCDButton button(128,64,50,50);
button.setPosition(100,100);

 

GLCDCheckBox(int , int , char *)

Creates a checkbox to perform certain tasks.

SYNTAX

GLCDCheckBox chkBox(x1Position,y1Position,dataString);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : data String.

USAGE

GLCDCheckBox chkBox (0,0,”1Sheeld”);

 

void setText(char *)

Sets the data resides the checkbox.

SYNTAX

chkBox.setText(checkBoxInfo);

RETURNS

None.

PARAMETERS

Take checkbox as char array data.

USAGE

chkBox.setText(”1Sheeld”);

 

void setSize(byte )

Set size of chkBox. (default=SMALL)

LITERALS:

SMALL

MEDIUM

LARGE

SYNTAX

chkBox.setSize(LITERAL);

RETURNS

None.

PARAMETERS

Takes one of the given literal declared above.

USAGE

chkBox.setSize(LARGE);

 

void select(void)

Selects the check box.

SYNTAX

chkBox.select();

RETURNS

None.

PARAMETERS

None.

USAGE

chkBox.select();

 

void deselect(void)

Deselects the check box.

SYNTAX

chkBox.deselect();

RETURNS

None.

PARAMETERS

None.

USAGE

chkBox.deselect();

 

void setOnChange(void(*userFunction)(byte))

Sets a certain user function to be invoked once the check box is selected.

SYNTAX

chkBox.setonChange(&userFunction);

RETURNS

None.

PARAMETERS

Take and address to the user function to be invoked once the check box is selected.

USAGE

chkBox.setOnChange(&userFunction);

 

void setVisibility(bool)

Makes the check Box visible or invisible.

SYNTAX

chkBox.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

chkBox.setVisibility(true);

 

voidsetPosition(int,int)

Reset the position of the check box.

SYNTAX

chkBox.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

GLCDCheckBox chkBox (128,64,”1Sheeld”);
chkBox.setPosition(100,100);

 

GLCDEllipse(int , int , int ,int )

Creates an Ellipse with two radius values.

SYNTAX

GLCDEllipse ellipse(x1Position,y1Position,semiminor axis,semimajor axis);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : semiminor axis.

4th parameter : semimajor axis.

USAGE

GLCDEllipse ellipse(0,0,50,20);

void setRadius(int ,int)

Change the semiminor axis and the semimajor axis of the ellipse object.

SYNTAX

rectangle.setRadius(semiminorAxis,semimajorAxis);

RETURNS

None.

PARAMETERS

1st parameter : semiminorAxis value.

2nd parameter : semimajorAxis value.

USAGE

rectangle.setRadius(20,30);

void setFill(byte )

Fill the shape (default = empty).

SYNTAX

ellipse.setFill(true);

RETURNS

None.

PARAMETERS

True/False filling or emptying the shape.

USAGE

ellipse.setFill(true);

void setVisibility(bool)

Makes the ellipse visible or invisible.

SYNTAX

ellipse.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

ellipse.setVisibility(true);

void setPosition(int,int)

Reset the position of the ellipse.

SYNTAX

ellipse.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

ellipse.setPosition(128,64);

GLCDLine (int, int, int, int)

Creates a line with a start and an end.

SYNTAX

GLCDLine line(x1Position,y1Position,x2Position,y2Position);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : x2 position.

4th parameter : y2 position.

USAGE

GLCDLine line(0,0,128,64);

void setCoordinates(int , int ,int ,int)

Update the coordinates of the line’s start point.

SYNTAX

line.setCoordinates(newX1Position,newY1Position);

RETURNS

None.

PARAMETERS

1st parameter : new x1 position from (0-255).

2nd parameter : new y1 position from (0-127).

USAGE

line.setCoordinates(0,0,255,127);

void setVisibility(bool)

Makes the line visible or invisible.

SYNTAX

line.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the line visible or invisible.

USAGE

line.setVisibility(true);

void setPosition(int,int)

Reset the line position with respect to its dimensions.

SYNTAX

line.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

line.setPosition(128,64);

GLCDPoint(int , int )

Draws a Point in a certain position of coordinates (x,y)

SYNTAX

GLCDPoint point(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

GLCD.draw(point);

void setVisibility(bool)

Makes the point visible or invisible.

SYNTAX

point.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the point visible or invisible.

USAGE

point.setVisibility(true);

void setPosition(int,int)

Reset point position.

SYNTAX

point.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

point.setPosition(128,64);

GLCDProgressBar(int , int , int ,int )

Creates a progress bar to simulate it’s values.

SYNTAX

GLCDProgressBar prgBar(x1Position,y1Position,width,height);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : width.

4th parameter : height.

USAGE

GLCDProgressBar prgBar(0,0,200,10);

void setRange(int , int)

Sets ranges of values to the created progressBar. (default 0 to 100)

SYNTAX

prgBar.setRange(start,end);

RETURNS

None.

PARAMETERS

1st parameter : start range value.

2nd parameter : end range value.

USAGE

prgBar.setRange(0,200);

void setValue(int )

Sets the value to be simulated on the progress bar.

SYNTAX

prgBar.setValue(value);

RETURNS

None.

PARAMETERS

Value to be simulated in the progress bar.

USAGE

prgBar.setValue(50);

void setDimensions(int int)

Resize the progressBar by setting its dimensions with respect to its range.

SYNTAX

prgBar.setDimensions(width,height);

RETURNS

None.

PARAMETERS

1st parameter: new width.

2nd parameter: new height.

USAGE

prgBar.setDimensions(100,20);

void setVisibility(bool)

Makes the progressBar visible or invisible.

SYNTAX

prgBar.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

prgBar.setVisibility(true);

void setPosition(int , int)

Reset the position of the progressBar.

SYNTAX

prgBar.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

prgBar.setPosition(128,64);

GLCDRadioButton(int , int , char * , int )

Simulates a radio button to perform tasks and assigned to a certain group of radio buttons.(group index may start from 0).

SYNTAX

GLCDRadioButton rdButton(x1Position,y1Position,dataString,0);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : data String.

4th parameter: group number.

USAGE

GLCDRadioButton rdbutton(0,0,”1Sheeld”,0);

GLCDRadioButton(int , int , char *

Creates a radio button to perform certain tasks. (default = not assigned to any group of radio buttons)

SYNTAX

GLCDRadioButton rdButton(x1Position,y1Position,dataString);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : data String.

USAGE

GLCDRadioButton rdbutton(0,0,”1Sheeld”);

bool isSelected(void)

Checks if the radioButton is selected.

SYNTAX

rdButton.isSelected( );

RETURNS

A True or False.

PARAMETERS

None.

USAGE

bool isRadioButtonSelected = false;
isRadioButtonSelected = rdButton.isSelected( );

int getGroupNumber(void)

Returns radioButton’s current group number.

SYNTAX

rdButton.getGroupNumber( );

RETURNS

Number of group radioButton assigned to.

PARAMETERS

None.

USAGE

int gourpNumber;
gourpNumber= rdButton.getGroupNumber( );

void setText(char *)

Sets the text resides the radio button.

SYNTAX

rdbutton.setText(buttonName);

RETURNS

None.

PARAMETERS

Take button name as string.

USAGE

rdbutton.setText(”1Sheeld”);

void setSize(byte )

Set radioButton size. (default=SMALL)

LITERALS:

SMALL                 

MEDIUM

LARGE

SYNTAX

rdButton.setSize(LITERAL);

RETURNS

None.

PARAMETERS

Takes one of the given literal declared above.

USAGE

rdButton.setSize(LARGE);

void setGroup(int )

Assign the button to a certain group.

SYNTAX

rdButton.setGroup(groupNumber);

RETURNS

None.

PARAMETERS

Group number to be assigned to.

USAGE

rdButton.setGroup(0);

void select(void)

Selects the button.

SYNTAX

rdButton.select();

RETURNS

None.

PARAMETERS

None.

USAGE

rdButton.select();

void setOnChange(void (*userFunction)(byte))

Sets a certain user function to be invoked once the radio button is selected.

SYNTAX

rdbutton.setonChange(&userFunction);

RETURNS

None.

PARAMETERS

Take and address to the user function to be invoked once the radio button is selected.

USAGE

rdbutton.setOnChange(&userFunction);

void setVisibility(bool)

Makes the radio button visible or invisible.

SYNTAX

rdbutton.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

GLCDRadioButton rdButton(0,0,”1Sheeld”);
rdbutton.setVisibility(true);

void setPosition(int,int)

Reset the position of the radiobutton.

SYNTAX

rdbutton.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

rdbutton.setPosition(100,100);

GLCDRectangle(int , int , int , int , int=0)

Creates a rectangle/rounded rectangle with certain width and height.

SYNTAX

GLCDRectangle rectangle(x1Position,y1Position,width,height,radius);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : width.

4th parameter : height.

5th parameter: radius to draw a rounded rectangle. (default=0)

USAGE

GLCDRectangle rectangle(0,0,50,20);
or
GLCDRectangle rectangle(0,0,50,20,20);

void setRadius(int)

Reset the radius of the rounded rectangle.

SYNTAX

rectangle.setRadius(radiusValue);

RETURNS

None.

PARAMETERS

Radius value.

USAGE

rectangle.setRadius(20);

void setFill(bool )

Fill the rectangle(default = empty).

SYNTAX

rectangle.setFill(true);

RETURNS

None.

PARAMETERS

True/False filling or emptying the rectangle.

USAGE

rectangle.setFill(true);

void setDimensions(int,int)

Resize rectangle by setting its new dimensions.

SYNTAX

rectangle.setDimensions(width,height);

RETURNS

None.

PARAMETERS

1st parameter: new width.

2nd parameter: new height.

USAGE

rectangle.setDimensions(50,50);

void setVisibility(bool)

Makes the rectangle visible or invisible.

SYNTAX

rectangle.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

rectangle.setVisibility(true);

void setPosition(int,int)

Reset the position of the rectangle.

SYNTAX

rectangle.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

rectangle.setPosition(128,64);

GLCDSlider(int , int , int ,int )

Creates a slider to perform a certain task.

SYNTAX

GLCDSlider slider(x1Position,y1Position,length,scrollRadius);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : length.

4th parameter: scroll Radius.

USAGE

GLCDSlider slider(0,0,200,20);

void setRange(int , int)

Sets range values of slider. (default 0-100)

SYNTAX

slider.setRange(start,end);

RETURNS

None.

PARAMETERS

1st parameter : start value.

2nd parameter : end value.

USAGE

slider.setRange(0,200);

void setValue(int )

Sets the value to be simulated on the slider.

SYNTAX

slider.setValue(value);

RETURNS

None.

PARAMETERS

Value to be simulated in the slider.

USAGE

slider.setValue(50);

int getValue(void)

Returns back the current value of the slider.

SYNTAX

slider.getValue( );

RETURNS

Current value of slider.

PARAMETERS

None

USAGE

int currentSliderValue = 0;
currentSliderValue  = slider.getValue( );

void setDimensions(int ,int)

Resize the slider by setting its dimensions.

SYNTAX

slider.setDimensions(width,height);

RETURNS

None.

PARAMETERS

1st parameter: new width.

2nd parameter: new height.

USAGE

slider.setDimensions(50,50);

void setOnChange(void (*userFunction)(int))

Sets a certain user function to be invoked once the check slider valuse is changed.

SYNTAX

slider.setonChange(&userFunction);

RETURNS

None.

PARAMETERS

Take and address to the user function to be invoked once the slider value is changed.

USAGE

slider.setOnChange(&userFunction);

void setVisibility(bool)

Makes the slider visible or invisible.

SYNTAX

slider.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the slider visible or invisible.

USAGE

GLCDSlider slider (0,0,200,10);
slider.setVisibility(true);

void setPosition(int,int)

Reset the position of the slider.

SYNTAX

slider.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

GLCDSlider slider(128,64,100,10);
slider.setPosition(100,100);

GLCDTextBox(int , int ,char * )

Creates a Text box to hold text.

SYNTAX

GLCDTextBox text(x1Position,y1Position,dataString);

RETURNS

None.

PARAMETERS

1st parameter : x1 position from (0-255).

2nd parameter : y1 position from (0-127).

3rd parameter : data string.

USAGE

GLCDTextBox textBox(0,0,”1Sheeld”);

void setFont(byte )

Set font of text. (default = ARIAL)

LITERALS:

ARIAL                  

ARIAL_BOLD       

ARIAL_ITALIC

COMIC_SANS     

SERIF   

SYNTAX

text.setFont(LITERAL);

RETURNS

None.

PARAMETERS

Takes one of the given literal declared above.

USAGE

textBox.setFont(SERIF);

void setSize(byte )

Set text size. (default=SMALL)

LITERALS:

SMALL                 

MEDIUM

LARGE

SYNTAX

text.setSize(LITERAL);

RETURNS

None.

PARAMETERS

Takes one of the given literal declared above.

USAGE

textBox.setSize(LARGE);

void setText(char*)

Reset the  text of the textBox.

SYNTAX

text.setText(textBoxName);

RETURNS

None.

PARAMETERS

Take textbox name char array.

USAGE

text.setText(”1Sheeld”);

void setVisibility(bool)

Makes the textBox visible or invisible.

SYNTAX

textBox.setVisibility(True/False);

RETURNS

None.

PARAMETERS

True or False to make the shape visible or invisible.

USAGE

textBox.setVisibility(true);

void setPosition(int,int)

Reset the position of the textBox.

SYNTAX

textBox.setPosition(xPosition,yPosition);

RETURNS

None.

PARAMETERS

1st parameter : x position from (0-255).

2nd parameter : y position from (0-127).

USAGE

textBox.setPosition(128,64);