Libraries.Robots.Lego.Screen Documentation
This class is an object representation of a LEGO Mindstorms EV3 LCD screen. It is used to display text and shapes on the screen. When using coordinates, the origin (0, 0) represents the bottom-left corner of the screen.
Example Code
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
class Main
action Main
Button button
Screen screen
screen:DrawRectangleFull(40, 80, 20, 20)
screen:DrawRectangleFull(116, 80, 20, 20)
screen:DrawLine(40, 40, 136, 40)
screen:DrawLine(40, 40, 40, 50)
screen:DrawLine(136, 40, 136, 50)
button:WaitForButtonPress()
end
end
Inherits from: Libraries.Language.Object
Actions Documentation
Clear()
This action removes everything from the screen.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
screen:DrawCircleFull(50, 50, 30)
button:WaitForButtonPress()
screen:Output("Hello!", 0)
button:WaitForButtonPress()
screen:Clear() //removes anything on the screen
screen:OutputCenter("Cleared!", 3)
button:WaitForButtonPress()
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
DrawCircleFull(integer x, integer y, integer radius)
This action draws a full circle on the screen.
Parameters
- integer x: specifies the center x coordinate of the circle.
- integer y: specifies the center y coordinate of the circle.
- integer radius: specifies how many pixels outward from the center the circle should be drawn. For example, a radius of 10 will draw 10 pixels outward from the center in every direction.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Button button
Screen screen
screen:DrawCircleFull(50, 80, 20) //draw left eye
screen:DrawCircleFull(126, 80, 20) //draw right eye
repeat 3 times
screen:EraseEllipseFull(50, 120, 20, 10) //erase previous left eyebrow
screen:EraseEllipseFull(126, 120, 20, 10) //erase previous right eyebrow
screen:EraseCircleFull(86, 40, 25) //erase previous mouth
screen:DrawEllipseFull(50, 110, 20, 10) //draw new left eyebrow
screen:DrawEllipseFull(126, 110, 20, 10) //draw new right eyebrow
screen:DrawCircleFull(86, 40, 15) //draw new mouth
button:WaitForButtonPress() //toggle the face
screen:EraseEllipseFull(50, 110, 20, 10) //erase previous left eyebrow
screen:EraseEllipseFull(126, 110, 20, 10) //erase previous right eyebrow
screen:EraseCircleFull(86, 40, 15) //erase previous mouth
screen:DrawEllipseFull(50, 120, 20, 10) //draw new left eyebrow
screen:DrawEllipseFull(126, 120, 20, 10) //draw new right eyebrow
screen:DrawCircleFull(86, 40, 25) //draw new mouth
button:WaitForButtonPress() //toggle the face
end
DrawCircleOutline(integer x, integer y, integer radius)
This action draws a circle outline on the screen.
Parameters
- integer x: specifies the center x coordinate of the circle.
- integer y: specifies the center y coordinate of the circle.
- integer radius: specifies how many pixels outward from the center the circle should be drawn. For example, a radius of 10 will draw the circle outline 10 pixels outward from the center in every direction.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawCircleOutline(89, 64, 20) //circle's center is at 89, 64 with a radius of 20
utility:DelayMilliseconds(500)
screen:DrawCircleOutline(89, 64, 30)
utility:DelayMilliseconds(500)
screen:DrawCircleOutline(89, 64, 40)
button:WaitForButtonPress()
DrawEllipseFull(integer x, integer y, integer width, integer height)
This action draws a filled ellipse on the screen.
Parameters
- integer x: specifies the center x coordinate of the ellipse.
- integer y: specifies the center y coordinate of the ellipse.
- integer width: specifies how wide the ellipse should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the ellipse should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Button button
Screen screen
screen:DrawEllipseFull(50, 80, 20, 20) //draw left eye
screen:DrawEllipseFull(126, 80, 20, 20) //draw right eye
repeat 3 times
screen:EraseEllipseFull(50, 115, 20, 10) //erase previous left eyebrow
screen:EraseEllipseFull(126, 115, 20, 10) //erase previous right eyebrow
screen:EraseEllipseFull(88, 35, 96, 30) //erase previous mouth
screen:DrawEllipseFull(50, 105, 20, 10) //draw new left eyebrow
screen:DrawEllipseFull(126, 105, 20, 10) //draw new right eyebrow
screen:DrawEllipseFull(88, 35, 96, 10) //draw new mouth
button:WaitForButtonPress() //toggle the face
screen:EraseEllipseFull(50, 105, 20, 10) //erase previous left eyebrow
screen:EraseEllipseFull(126, 105, 20, 10) //erase previous right eyebrow
screen:EraseEllipseFull(88, 35, 96, 10) //erase previous mouth
screen:DrawEllipseFull(50, 115, 20, 10) //draw new left eyebrow
screen:DrawEllipseFull(126, 115, 20, 10) //draw new right eyebrow
screen:DrawEllipseFull(88, 35, 96, 30) //draw new mouth
button:WaitForButtonPress() //toggle the face
end
DrawEllipseOutline(integer x, integer y, integer width, integer height)
This action draws an ellipse outline on the screen.
Parameters
- integer x: specifies the center x coordinate of the ellipse.
- integer y: specifies the center y coordinate of the ellipse.
- integer width: specifies how wide the ellipse should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the ellipse should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawEllipseOutline(89, 64, 20, 10) //ellipse's center is at 89, 64 with a width of 20 and height of 10
utility:DelayMilliseconds(500)
screen:DrawEllipseOutline(89, 64, 40, 20)
utility:DelayMilliseconds(500)
screen:DrawEllipseOutline(89, 64, 60, 30)
utility:DelayMilliseconds(500)
screen:DrawEllipseOutline(89, 64, 80, 40)
utility:DelayMilliseconds(500)
screen:DrawEllipseOutline(89, 64, 100, 50)
button:WaitForButtonPress()
DrawLine(integer xStart, integer yStart, integer xEnd, integer yEnd)
This action draws a line on the screen.
Parameters
- integer xStart: specifies the x coordinate where the line should start at.
- integer yStart: specifies the y coordinate where the line should start at.
- integer xEnd: specifies the x coordinate where the line should end at.
- integer yEnd: specifies the y coordinate where the line should end at.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawLine(30, 30, 89, 98)
utility:DelayMilliseconds(500)
screen:DrawLine(89, 98, 148, 30)
utility:DelayMilliseconds(500)
screen:DrawLine(148, 30, 30, 30)
button:WaitForButtonPress()
DrawPixel(integer x, integer y)
This action places a pixel on the screen
Parameters
- integer x: specifies the x coordinate of the pixel being drawn.
- integer y: specifies the y coordinate of the pixel being drawn.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
Screen screen
Utility utility
integer y = 0
repeat while y <= 127 //top of the screen
integer x = 0
repeat while x <= 177 //right side of the screen
screen:DrawPixel(x, y)
utility:DelayMilliseconds(1)
x = x + 1
end
y = y + 1
end
DrawRectangleFull(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
This action draws a filled in rectangle on screen.
Parameters
- integer xBottomLeft: specifies the x coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer yBottomLeft: specifies the y coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer width: specifies how wide the rectangle should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the rectangle should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Button button
Screen screen
screen:DrawRectangleFull(40, 80, 20, 20) //draw left eye
screen:DrawRectangleFull(116, 80, 20, 20) //draw right eye
repeat 3 times
screen:EraseRectangleFull(40, 120, 20, 10) //erase previous left eyebrow
screen:EraseRectangleFull(116, 120, 20, 10) //erase previous right eyebrow
screen:EraseRectangleFull(40, 30, 96, 30) //erase previous mouth
screen:DrawRectangleFull(40, 110, 20, 10) //draw new left eyebrow
screen:DrawRectangleFull(116, 110, 20, 10) //draw new right eyebrow
screen:DrawRectangleFull(40, 40, 96, 10) //draw new mouth
button:WaitForButtonPress() //toggle the face
screen:EraseRectangleFull(40, 110, 20, 10) //erase previous left eyebrow
screen:EraseRectangleFull(116, 110, 20, 10) //erase previous right eyebrow
screen:EraseRectangleFull(40, 40, 96, 10) //erase previous mouth
screen:DrawRectangleFull(40, 120, 20, 10) //draw new left eyebrow
screen:DrawRectangleFull(116, 120, 20, 10) //draw new right eyebrow
screen:DrawRectangleFull(40, 30, 96, 30) //draw new mouth
button:WaitForButtonPress() //toggle the face
end
DrawRectangleOutline(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
This action draws an outline of a rectangle on the screen.
Parameters
- integer xBottomLeft: specifies the x coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer yBottomLeft: specifies the y coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer width: specifies how wide the rectangle should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the rectangle should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawRectangleOutline(30, 30, 118, 68) //rectangle's bottom left corner is 30, 30 with a width of 118 and height of 68
utility:DelayMilliseconds(500)
screen:DrawRectangleOutline(40, 40, 98, 48) //a smaller rectangle
utility:DelayMilliseconds(500)
screen:DrawRectangleOutline(50, 50, 78, 28) //an even smaller rectangle
button:WaitForButtonPress()
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
EraseCircleFull(integer x, integer y, integer radius)
This action erases pixels in the shape of a full circle from the screen.
Parameters
- integer x: specifies the center x coordinate of the circle.
- integer y: specifies the center y coordinate of the circle.
- integer radius: specifies how many pixels outward from the center the circle should be erased. For example, a radius of 10 will erase 10 pixels outward from the center in every direction.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Button button
Screen screen
screen:DrawRectangleFull(0, 0, 177, 127) //make the screen black
screen:EraseCircleFull(50, 80, 20) //erase a left eye from screen
screen:EraseCircleFull(126, 80, 20) //erase a right eye from screen
repeat 3 times
screen:DrawEllipseFull(50, 120, 20, 10) //fill in previous left eyebrow
screen:DrawEllipseFull(126, 120, 20, 10) //fill in previous right eyebrow
screen:DrawCircleFull(86, 40, 25) //fill in previous mouth
screen:EraseEllipseFull(50, 110, 20, 10) //erase new left eyebrow from screen
screen:EraseEllipseFull(126, 110, 20, 10) //erase new right eyebrow from screen
screen:EraseCircleFull(86, 40, 15) //erase new mouth from screen
button:WaitForButtonPress() //toggle the face
screen:DrawEllipseFull(50, 110, 20, 10) //fill in previous left eyebrow
screen:DrawEllipseFull(126, 110, 20, 10) //fill in previous right eyebrow
screen:DrawCircleFull(86, 40, 15) //fill in previous mouth
screen:EraseEllipseFull(50, 120, 20, 10) //erase new left eyebrow from screen
screen:EraseEllipseFull(126, 120, 20, 10) //erase new right eyebrow from screen
screen:EraseCircleFull(86, 40, 25) //erase new mouth from screen
button:WaitForButtonPress() //toggle the face
end
EraseCircleOutline(integer x, integer y, integer radius)
This action erases pixels in the shape of a circle outline from the screen.
Parameters
- integer x: specifies the center x coordinate of the circle.
- integer y: specifies the center y coordinate of the circle.
- integer radius: specifies how many pixels outward from the center of the circle that should be erased. For example, a radius of 10 will erase the circle outline 10 pixels outward from the center in every direction.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawRectangleFull(0, 0, 177, 127) //makes the screen black
screen:EraseCircleOutline(89, 64, 20) //circle's center is at 89, 64 with a radius of 20
utility:DelayMilliseconds(500)
screen:EraseCircleOutline(89, 64, 30)
utility:DelayMilliseconds(500)
screen:EraseCircleOutline(89, 64, 40)
button:WaitForButtonPress()
EraseEllipseFull(integer x, integer y, integer width, integer height)
This action erases a pixels in the shape of a filled ellipse from the screen.
Parameters
- integer x: specifies the center x coordinate of the ellipse.
- integer y: specifies the center y coordinate of the ellipse.
- integer width: specifies how wide the ellipse should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the ellipse should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Button button
Screen screen
screen:DrawRectangleFull(0, 0, 177, 127) //make the screen black
screen:EraseEllipseFull(50, 80, 20, 20) //erase a left eye from the screen
screen:EraseEllipseFull(126, 80, 20, 20) //erase a right eye from the screen
repeat 3 times
screen:DrawEllipseFull(50, 115, 20, 10) //fill in previous left eyebrow
screen:DrawEllipseFull(126, 115, 20, 10) //fill in previous right eyebrow
screen:DrawEllipseFull(88, 35, 96, 30) //fill in previous mouth
screen:EraseEllipseFull(50, 105, 20, 10) //erase a new left eyebrow from the screen
screen:EraseEllipseFull(126, 105, 20, 10) //erase a new right eyebrow from the screen
screen:EraseEllipseFull(88, 35, 96, 10) //erase a new mouth from the screen
button:WaitForButtonPress() //toggle the face
screen:DrawEllipseFull(50, 105, 20, 10) //fill in previous left eyebrow
screen:DrawEllipseFull(126, 105, 20, 10) //fill in previous right eyebrow
screen:DrawEllipseFull(88, 35, 96, 10) //fill in previous mouth
screen:EraseEllipseFull(50, 115, 20, 10) //erase a new left eyebrow from the screen
screen:EraseEllipseFull(126, 115, 20, 10) //erase a new right eyebrow from the screen
screen:EraseEllipseFull(88, 35, 96, 30) //erase a new mouth from the screen
button:WaitForButtonPress() //toggle the face
end
EraseEllipseOutline(integer x, integer y, integer width, integer height)
This action erases pixels in the shape of an ellipse outline from the screen.
Parameters
- integer x: specifies the center x coordinate of the ellipse.
- integer y: specifies the center y coordinate of the ellipse.
- integer width: specifies how wide the ellipse should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the ellipse should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawRectangleFull(0, 0, 177, 127) //make the screen black
screen:EraseEllipseOutline(89, 64, 20, 10) //ellipse's center is at 89, 64 with a width of 20 and height of 10
utility:DelayMilliseconds(500)
screen:EraseEllipseOutline(89, 64, 40, 20)
utility:DelayMilliseconds(500)
screen:EraseEllipseOutline(89, 64, 60, 30)
utility:DelayMilliseconds(500)
screen:EraseEllipseOutline(89, 64, 80, 40)
utility:DelayMilliseconds(500)
screen:EraseEllipseOutline(89, 64, 100, 50)
button:WaitForButtonPress()
ErasePixel(integer x, integer y)
This action removes a single pixel from the screen.
Parameters
- integer x: specifies the x coordinate of the pixel being erased.
- integer y: specifies the y coordinate of the pixel being erased.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
screen:DrawCircleFull(50, 50, 25)
screen:ErasePixel(50, 50) //removes the center pixel of the circle
screen:ErasePixel(51, 51)
screen:ErasePixel(49, 49)
screen:ErasePixel(51, 49)
screen:ErasePixel(49, 51)
button:WaitForButtonPress()
EraseRectangleFull(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
This action erases pixels in the shape of a full rectangle from the screen.
Parameters
- integer xBottomLeft: specifies the x coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer yBottomLeft: specifies the y coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer width: specifies how wide the ellipse should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the ellipse should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
screen:DrawRectangleFull(0, 0, 177, 127) //make the screen black
screen:EraseRectangleFull(40, 80, 20, 20) //draw left eye
screen:EraseRectangleFull(116, 80, 20, 20) //draw right eye
repeat 3 times
screen:DrawRectangleFull(40, 120, 20, 10) //erase previous left eyebrow
screen:DrawRectangleFull(116, 120, 20, 10) //erase previous right eyebrow
screen:DrawRectangleFull(40, 30, 96, 30) //erase previous mouth
screen:EraseRectangleFull(40, 110, 20, 10) //draw new left eyebrow
screen:EraseRectangleFull(116, 110, 20, 10) //draw new right eyebrow
screen:EraseRectangleFull(40, 40, 96, 10) //draw new mouth
button:WaitForButtonPress() //toggle the face
screen:DrawRectangleFull(40, 110, 20, 10) //erase previous left eyebrow
screen:DrawRectangleFull(116, 110, 20, 10) //erase previous right eyebrow
screen:DrawRectangleFull(40, 40, 96, 10) //erase previous mouth
screen:EraseRectangleFull(40, 120, 20, 10) //draw new left eyebrow
screen:EraseRectangleFull(116, 120, 20, 10) //draw new right eyebrow
screen:EraseRectangleFull(40, 30, 96, 30) //draw new mouth
button:WaitForButtonPress() //toggle the face
end
EraseRectangleOutline(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
This action erases pixels in the shape of a rectangle outline from the screen.
Parameters
- integer xBottomLeft: specifies the x coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer yBottomLeft: specifies the y coordinate of the rectangle's bottom left corner where the rectangle starts from.
- integer width: specifies how wide the rectangle should be, in pixels. The visible screen pixels for width range from 0 to 177.
- integer height: specifies how tall the rectangle should be, in pixels. The visible screen pixels for height range from 0 to 127.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.Button
Screen screen
Utility utility
Button button
screen:DrawRectangleFull(0, 0, 177, 127) //makes the screen black
utility:DelayMilliseconds(500)
screen:EraseRectangleOutline(30, 30, 118, 68) //rectangle's bottom left corner is 30, 30 with a width of 118 and height of 68
utility:DelayMilliseconds(500)
screen:EraseRectangleOutline(40, 40, 98, 48)
utility:DelayMilliseconds(500)
screen:EraseRectangleOutline(50, 50, 78, 28)
button:WaitForButtonPress()
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
Output(text message, integer line, integer indent)
This action displays a text message on a specific line of the screen with an indentation.
Parameters
- text message: is what will be displayed on the screen.
- integer line: specifies which line number the message will appear on. Valid line numbers are 0 through 7, where 0 is the top line.
- integer indent: specifies how much of an indent, measured in a character's width (1 character's width = 8 pixels), the message should have. The visible width of the screen ranges from 0 to 177 pixels, but you can use any size indent. Negative values are accepted and shift the text message to the left.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
integer indent = 0
integer line = 0
repeat until line = 8
screen:Output("Indent = " + indent, line, indent) //displays the current indent on screen
line = line + 1
indent = indent + 1
end
button:WaitForButtonPress()
Output(text message, integer line)
This action displays a text message on a specific line of the screen.
Parameters
- text message: is what should be displayed on the screen.
- integer line: specifies which line the text should be displayed on. Valid line numbers are 0 through 7, where 0 is the top line.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
Screen screen
Utility utility
screen:Output("Hello!", 0)
utility:DelayMilliseconds(500)
screen:Output("I", 2)
utility:DelayMilliseconds(500)
screen:Output("Am", 3)
utility:DelayMilliseconds(500)
screen:Output("Your", 4)
utility:DelayMilliseconds(500)
screen:Output("Robot!", 5)
utility:DelayMilliseconds(2000)
OutputCenter(text message, integer line)
This action displays a centered text message on a specified text line of the screen
Parameters
- text message: is what will be displayed on the screen
- integer line: specifies what text line the message should appear on. Valid text lines are 0 through 7, where 0 is the top line.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.InfraredSensor
use Libraries.Robots.Lego.Motor
use Libraries.Robots.Lego.Utility
Screen screen
InfraredSensor infraredSensor
Motor motor
Utility utility
infraredSensor:SetPort(4)
motor:RotateForward(motor:MOTOR_B)
motor:RotateForward(motor:MOTOR_C) //two motors to move the robot, connected to ports B and C
repeat 20 times
screen:OutputCenter("Distance: " + infraredSensor:GetDistance(), 0) //displays the distance on the top line
utility:DelayMilliseconds(100)
end
OutputCenterLarge(text message, integer line)
This action displays a centered large text message, with each character's height spanning two text lines.
Parameters
- text message: specifies the message to be displayed on screen.
- integer line: specifies which line the message should start on. Since the message spans two text lines, the line specified and the one below it will be used to display the message.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.InfraredSensor
use Libraries.Robots.Lego.Motor
use Libraries.Robots.Lego.Utility
Screen screen
InfraredSensor infraredSensor
Motor motor
Utility utility
infraredSensor:SetPort(4)
motor:RotateForward(motor:MOTOR_B)
motor:RotateForward(motor:MOTOR_C) //two motors to move the robot, connected to ports B and C
repeat 10 times
screen:OutputCenterLarge("Dist.: " + infraredSensor:GetDistance(), 1) //displays the distance on the top line
utility:DelayMilliseconds(100)
end
OutputInvertedColor(text message, integer line)
This action displays a message using inverted pixel colors. The rectangular space reserved for each character becomes solid black and the text displays as a cutout from that.
Parameters
- text message: specifies the text that should be displayed on screen.
- integer line: specifies the line number that the text should appear on. Valid line numbers are 0 through 7, where 0 is the top line.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
Screen screen
Utility utility
screen:OutputInvertedColor("Hello!", 0)
utility:DelayMilliseconds(500)
screen:OutputInvertedColor("I", 2)
utility:DelayMilliseconds(500)
screen:OutputInvertedColor("Am", 3)
utility:DelayMilliseconds(500)
screen:OutputInvertedColor("Your", 4)
utility:DelayMilliseconds(500)
screen:OutputInvertedColor("Robot!", 5)
utility:DelayMilliseconds(2000)
OutputInvertedColor(text message, integer line, integer indent)
This action displays a message using inverted pixel colors.
Parameters
- text message: is what will be displayed on the screen.
- integer line: specifies which line number the message will appear on. Valid line numbers are 0 through 7, where 0 is the top line.
- integer indent: specifies how much of an indent, measured in a character's width (1 character's width = 8 pixels), the message should have. The visible width of the screen ranges from 0 to 177 pixels, but you can use any size indent. Negative values are accepted and shift the text message to the left.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
integer indent = 0
integer line = 0
repeat until line = 8
screen:OutputInvertedColor("Indent = " + indent, line, indent) //displays the current indent on screen
line = line + 1
indent = indent + 1
end
button:WaitForButtonPress()
OutputLarge(text message, integer line)
This action displays a large text message, with each character's height spanning two text lines.
Parameters
- text message: specifies the message to be displayed on screen.
- integer line: specifies which line the message should start on. Since the message spans two text lines, the line specified and the one below it will be used to display the message.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
Screen screen
Utility utility
screen:OutputLarge("This", 0)
screen:OutputLarge("is", 2)
screen:OutputLarge("large", 4)
screen:OutputLarge("text!", 6)
utility:DelayMilliseconds(3000)
OutputLarge(text message, integer line, integer indent)
This action displays a large text message, with each character's height spanning two text lines.
Parameters
- text message: specifies the message to be displayed on screen.
- integer line: specifies which line the message should start on. Since the message spans two text lines, the line specified and the one below it will be used to display the message.
- integer indent: specifies how much of an indent, measured in a character's width (1 character's width = 8 pixels), the message should have. The visible width of the screen ranges from 0 to 177 pixels, but you can use any size indent. Negative values are accepted and shift the text message to the left.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Button
Screen screen
Button button
integer indent = 0
integer line = 0
repeat until line = 8
screen:OutputLarge("indent:" + indent, line, indent) //displays the current indent on screen
line = line + 2
indent = indent + 1
end
button:WaitForButtonPress()
ScrollUp(text message)
This action moves everything on the screen up by one text line and then places a message on the bottom line.
Parameters
- text message: is the message that will be displayed on the bottom text line after scrolling up.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.ColorSensor
Screen screen
Utility utility
ColorSensor colorSensor
colorSensor:SetPort(colorSensor:PORT_3)
text color = ""
repeat 20 times
color = colorSensor:GetColor()
if color not= "none"
screen:ScrollUp(color) //scroll up and display color name on the bottom text line
end
utility:DelayMilliseconds(200)
end
ScrollUp(integer lines)
This action scrolls up an amount of text lines based on the passed parameter.
Parameters
- integer lines: represents the amount of text lines to be scrolled up
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
Screen screen
Utility utility
screen:Output("Beep", 7)
utility:DelayMilliseconds(500)
screen:ScrollUp(1) //scroll up one line
screen:Output("Boop", 7)
utility:DelayMilliseconds(500)
screen:ScrollUp(2) //scroll up two lines
screen:Output("I am a robot!", 7)
utility:DelayMilliseconds(3000)
ScrollUp()
This action moves everything on the screen up by one text line.
Example
use Libraries.Robots.Lego.Screen
use Libraries.Robots.Lego.Utility
use Libraries.Robots.Lego.ColorSensor
Screen screen
Utility utility
ColorSensor colorSensor
colorSensor:SetPort(colorSensor:PORT_3)
text color = ""
repeat 20 times
color = colorSensor:GetColor()
if color not= "none"
screen:ScrollUp() //scroll up
screen:Output(color, 7) //display color name on the bottom text line
end
utility:DelayMilliseconds(200)
end
On this page
Variables TableAction Documentation- Clear()
- Compare(Libraries.Language.Object object)
- DrawCircleFull(integer x, integer y, integer radius)
- DrawCircleOutline(integer x, integer y, integer radius)
- DrawEllipseFull(integer x, integer y, integer width, integer height)
- DrawEllipseOutline(integer x, integer y, integer width, integer height)
- DrawLine(integer xStart, integer yStart, integer xEnd, integer yEnd)
- DrawPixel(integer x, integer y)
- DrawRectangleFull(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
- DrawRectangleOutline(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
- Equals(Libraries.Language.Object object)
- EraseCircleFull(integer x, integer y, integer radius)
- EraseCircleOutline(integer x, integer y, integer radius)
- EraseEllipseFull(integer x, integer y, integer width, integer height)
- EraseEllipseOutline(integer x, integer y, integer width, integer height)
- ErasePixel(integer x, integer y)
- EraseRectangleFull(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
- EraseRectangleOutline(integer xBottomLeft, integer yBottomLeft, integer width, integer height)
- GetHashCode()
- Output(text message, integer line, integer indent)
- Output(text message, integer line)
- OutputCenter(text message, integer line)
- OutputCenterLarge(text message, integer line)
- OutputInvertedColor(text message, integer line)
- OutputInvertedColor(text message, integer line, integer indent)
- OutputLarge(text message, integer line)
- OutputLarge(text message, integer line, integer indent)
- ScrollUp(text message)
- ScrollUp(integer lines)
- ScrollUp()