drawLine()
[Graphics]
void drawLine (int x1, int y1, int x2, int y2);Description
Draws a line from the point (x1, y1) to the point (x2, y2).
Parameters
x1: the x-coordinate of the starting point of the
line.
y1: the y-coordinate of the starting point of the
line.
x2: the x-coordinate of the ending point of the
line.
y2: the y-coordinate of the ending point of the
line.
Returns
Nothing.
Example Code
The code draws a diagonal line from the top-left corner to the bottom-right corner of the chip.
void setup() {
int width = chipWidth(); // gets the width of the chip
int height = chipHeight(); // gets the height of the chip
drawLine(0, 0, width, height); // draws a diagonal line from the top-left corner to the bottom-right corner of the chip
}
void loop() {
}Notes and Warnings
All coordinates must be inside the chip boundaries, use the functions
chipWidth() and chipHeight() to get the chip
dimensions.
