Libraries.Robots.Spike.LightMatrix Documentation
The light matrix controls a 5 x5 set of pixels on the Spike robot. The first pixel in the top left is 0,0 and the bottom right pixel is 4,4. You can get and set the pixels manually, clear the display, or write words to it.
Example Code
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Write("Hi!")
Inherits from: Libraries.Language.Object
Variables Table
Variables | Description |
---|---|
integer DIAMOND | |
integer ARROW_S | |
integer SQUARE_SMALL | |
integer CLOCK2 | |
integer GIRAFFE | |
integer ARROW_N | |
integer CLOCK3 | |
integer STICKFIGURE | |
integer CLOCK6 | |
integer TORTOISE | |
integer MEH | |
integer SURPRISED | |
integer SAD | |
integer ORIENTATION_LEFT | |
integer ANGRY | |
integer ARROW_W | |
integer SNAKE | Writes text to the display. |
integer CLOCK9 | |
integer BUTTERFLY | |
integer RABBIT | |
integer MUSIC_QUAVER | |
integer ARROW_SW | |
integer SMILE | |
integer TARGET | |
integer ARROW_SE | |
integer ORIENTATION_UP | |
integer ARROW_NE | |
integer CLOCK7 | |
integer ARROW_NW | |
integer CLOCK12 | |
integer GHOST | |
integer CLOCK8 | |
integer GO_DOWN | |
integer FABULOUS | |
integer ASLEEP | |
integer SILLY | |
integer CLOCK4 | |
integer SKULL | |
integer TRIANGLE | |
integer DUCK | |
integer MUSIC_QUAVERS | |
integer ARROW_E | |
integer CONFUSED | |
integer ORIENTATION_RIGHT | |
integer ROLLERSKATE | |
integer CLOCK5 | |
integer CLOCK1 | |
integer GO_UP | |
integer ORIENTATION_DOWN | |
integer XMAS | |
integer CLOCK11 | |
integer DIAMOND_SMALL | |
integer HAPPY | |
integer SWORD | |
integer CLOCK10 | |
integer TSHIRT | |
integer GO_LEFT | |
integer GO_RIGHT | |
integer HOUSE | |
integer UMBRELLA | |
integer MUSIC_CROTCHET | |
integer COW | |
integer PACMAN | |
integer SQUARE | |
integer NO | |
integer HEART_SMALL | |
integer TRIANGLE_LEFT | |
integer PITCHFORK | |
integer YES | |
integer HEART | |
integer CHESSBOARD |
Actions Documentation
Clear()
Sets the intensity of all pixels to 0
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Clear()
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)
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)
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()
GetOrientation()
Gets the orientation of the light matrix
Return
integer: Orientation, a value from 0 to 3 (ORIENTATION_UP, ORIENTATION_RIGHT, ORIENTATION_DOWN, ORIENTATION_LEFT)
Example
use Libraries.Robots.Spike.LightMatrix
LighMatrix lights
integer orientation = lights:GetOrientation()
GetPixel(integer x, integer y)
Gets the intensity, between 0 and 100, of a particular pixel on the display.
Parameters
- integer x: The x coordinate from 0 to 4
- integer y: The y coordinate from 0 to 4
Return
integer: The intensity, which is a value between 0 and 100
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
output lights:GetPixel(0,0)
SetOrientation(integer orientation)
Sets the orientation of the light matrix
Parameters
- integer orientation: The direction to orient the light matrix
Return
integer: Orientation, a value from 0 to 3 (ORIENTATION_UP, ORIENTATION_RIGHT, ORIENTATION_DOWN, ORIENTATION_LEFT) which can be accessed from the class constants
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:SetOrientation(lights:ORIENTATION_UP)
SetPixel(integer x, integer y, integer intensity)
Sets the intensity, between 0 and 100, of a particular pixel on the display.
Parameters
- integer x: The x coordinate from 0 to 4
- integer y: The y coordinate from 0 to 4
- integer intensity: A value between 0 and 100
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:SetPixel(0,0,100)
lights:SetPixel(4,4,100)
Show(Libraries.Containers.Array<integer> pixels)
Displays a configured image using an array of length 25. The order is left to right top to bottom on a 5x5 grid
Parameters
- Libraries.Containers.Array: An integer array of pixels to display, where each index represents the intensity from 0 to 100 of the corresponding pixel
Example
use Libraries.Robots.Spike.LightMatrix
use Libraries.Containers.Array
Array<integer> pixels
LightMatrix lights
integer i = 0
repeat 25 times
pixels:Add(i)
i = i + 4
end
lights:Show(pixels)
ShowImage(integer image)
Displays a built in image. Constants are in the class and the values go from 1 to 67
Parameters
- integer image: The built in image to display
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:ShowImage(1)
Write(text value)
Writes text to the display.
Parameters
- text value: The text to display
Example
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Write("Hi!")
On this page
Variables TableAction Documentation- Clear()
- Compare(Libraries.Language.Object object)
- Equals(Libraries.Language.Object object)
- GetHashCode()
- GetOrientation()
- GetPixel(integer x, integer y)
- SetOrientation(integer orientation)
- SetPixel(integer x, integer y, integer intensity)
- Show(Libraries.Containers.Array
pixels) - ShowImage(integer image)
- Write(text value)