Initializes the graphics device.
YourScreen.begin()
None
1 for success, 0 on failure.
if (!YourScreen.begin()) {
Serial.println("Failed to initialize the display!");
while (1);
}
Stops the graphics device.
YourScreen.end()
None
Nothing
YourScreen.end();
Returns the pixel width of the graphics device.
YourScreen.width()
None
Returns the pixel width of the graphics device.
int w = YourScreen.width();
Returns the pixel height of the graphics device.
YourScreen.height()
None
Returns the pixel height of the graphics device.
int h = YourScreen.height();
Begins a drawing operation.
YourScreen.beginDraw()
None
Nothing
YourScreen.beginDraw();
YourScreen.set(0, 0, 255, 0, 0);
YourScreen.endDraw();
Ends a drawing operation, any drawing operations after beginDraw() is called will be displayed to the screen.
YourScreen.endDraw()
None
Nothing
YourScreen.beginDraw();
YourScreen.set(0, 0, 255, 0, 0);
YourScreen.endDraw();
Set the background color of drawing operations. Used when calling clear() or drawing text.
YourScreen.background(r, g, b)
YourScreen.background(color)
- r: red color value (0 - 255)
- g: green color value (0 - 255)
- b: blue color value (0 - 255)
- color: 24-bit RGB color, 0xrrggbb
Nothing
YourScreen.beginDraw();
YourScreen.background(255, 0, 0);
YourScreen.clear();
YourScreen.endDraw();
Clear the screen contents or a specific pixel, uses the background colour set in background().
YourScreen.clear()
YourScreen.clear(x, y)
- x: x position of the pixel to clear
- y: y position of the pixel to clear
Nothing
YourScreen.beginDraw();
YourScreen.background(255, 0, 0);
YourScreen.clear();
YourScreen.endDraw();
Set the fill color of drawing operations.
YourScreen.fill(r, g, b)
YourScreen.fill(color)
- r: red color value (0 - 255)
- g: green color value (0 - 255)
- b: blue color value (0 - 255)
- color: 24-bit RGB color, 0xrrggbb
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.noStroke();
YourScreen.fill(255, 255, 0);
YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Clears the fill color of drawing operations.
YourScreen.noFill()
None
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(255, 0, 255);
YourScreen.noFill();
YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Set the stroke color of drawing operations.
YourScreen.stroke(r, g, b)
YourScreen.stroke(color)
- r: red color value (0 - 255)
- g: green color value (0 - 255)
- b: blue color value (0 - 255)
- color: 24-bit RGB color, 0xrrggbb
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(255, 0, 255);
YourScreen.noFill();
YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Clears the stroke color of drawing operations.
YourScreen.noStroke()
None
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.noStroke();
YourScreen.fill(255, 255, 0);
YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Stroke a line, uses the stroke color set in stroke().
YourScreen.line(x1, y1, x2, y2)
- x1: x position of the starting point of the line
- y1: y position of the starting point of the line
- x2: x position of the end point of the line
- y2: y position of the end point of the line
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(0, 0, 255);
YourScreen.line(0, 0, YourScreen.width() - 1, YourScreen.height() - 1);
YourScreen.endDraw();
Stroke a point, uses the stroke color set in stroke().
YourScreen.point(x, y)
x: x position of the point y: y position of the point
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(0, 255, 0);
YourScreen.point(1, 1);
YourScreen.endDraw();
Stroke and fill a rectangle, uses the stroke color set in stroke() and the fill color set in fill().
YourScreen.rect(x, y, width, height)
- x: x position of the rectangle
- y: y position of the rectangle
- width: width of the rectangle
- height: height of the rectangle
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.noStroke();
YourScreen.fill(255, 255, 0);
YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Stroke and fill a circle, uses the stroke color set in stroke() and the fill color set in fill().
YourScreen.circle(x, y, diameter)
- x: x center position of the circle
- y: y center position of the circle
- diameter: diameter of the circle
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.noStroke();
YourScreen.fill(255, 255, 0);
YourScreen.circle(YourScreen.width()/2, YourScreen.height()/2, YourScreen.height());
YourScreen.endDraw();
Stroke and fill an ellipse, uses the stroke color set in stroke() and the fill color set in fill().
YourScreen.ellipse(x, y, width, height)
- x: x center position of the ellipse
- y: y center position of the ellipse
- width: width of the ellipse
- height: height of the ellipse
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.noStroke();
YourScreen.fill(255, 255, 0);
YourScreen.ellipse(YourScreen.width()/2, YourScreen.height()/2, YourScreen.width(), YourScreen.height());
YourScreen.endDraw();
Draw some text, uses the stroke color set in stroke() and the background color set in background().
YourScreen.text(string)
YourScreen.text(string, x, y)
- string: string to draw
- x: x position for the start of the text
- y: y position for the start of the text
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(255, 255, 255);
YourScreen.text("abc", 0, 1);
YourScreen.endDraw();
Sets the font used for text. The library current has the Font_4x6 and Font_5x7 built in.
YourScreen.textFont(font)
font: font to set
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(255, 255, 255);
YourScreen.textFont(Font_5x7);
YourScreen.text("abc", 0, 1);
YourScreen.endDraw();
Returns the width, in pixels, of the current font.
YourScreen.textFontWidth()
None
Nothing
int w = YourScreen.textFontWidth();
Returns the height, in pixels, of the current font.
YourScreen.textFontHeight()
None
Nothing
int h = YourScreen.textFontHeight();
Set a text scale factor
YourScreen.textSize(scale)
YourScreen.textSize(scaleX, scaleY)
scale: scale factor used for both x and y scaleX: x scale factor scaleY: y scale factor
Nothing
YourScreen.beginDraw();
YourScreen.clear();
YourScreen.stroke(255, 255, 255);
YourScreen.textFont(Font_5x7);
YourScreen.textSize(5);
YourScreen.text("abc", 0, 1);
YourScreen.endDraw();
Set a pixel’s color value.
YourScreen.set(x, y, r, g, b)
YourScreen.set(x, y, color)
x: x position of the pixel y: y position of the pixel r: red color value (0 - 255) g: green color value (0 - 255) b: blue color value (0 - 255) color: 24-bit RGB color, 0xrrggbb
Nothing
YourScreen.beginDraw();
YourScreen.point(1, 1, 0, 255, 0);
YourScreen.endDraw();
Start the process of displaying and optionally scrolling text. The Print interface can be used to set the text.
YourScreen.beginText()
YourScreen.beginText(x, y, r, g, b)
YourScreen.beginText(x, y, color)
x: x position of the text y: y position of the text r: red color value (0 - 255) g: green color value (0 - 255) b: blue color value (0 - 255) color: 24-bit RGB color, 0xrrggbb
Nothing
YourScreen.beginText(0, 0, 127, 0, 0);
YourScreen.print("Hi");
YourScreen.endText();
End the process of displaying and optionally scrolling text.
YourScreen.endText()
YourScreen.endText(scrollDirection)
scrollDirection: (optional) the direction to scroll, defaults to NO_SCROLL if not provided. Valid options are NO_SCROLL, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLL_DOWN
Nothing
YourScreen.beginText(0, 0, 127, 0, 0);
YourScreen.print("Hi");
YourScreen.endText();
Sets the text scrolling speed, the speed controls the delay in milliseconds between scrolling each pixel.
YourScreen.textScrollSpeed(speed)
speed: scroll speed
Nothing
YourScreen.beginText(0, 0, 127, 0, 0);
YourScreen.textScrollSpeed(500);
YourScreen.print("Hello There!");
YourScreen.endText(true);