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 SNAKE | Writes text to the display. |
integer BUTTERFLY | |
integer CLOCK12 | |
integer RABBIT | |
integer COW | |
integer ORIENTATION_RIGHT | |
integer PACMAN | |
integer CONFUSED | |
integer MEH | |
integer MUSIC_CROTCHET | |
integer SAD | |
integer HAPPY | |
integer UMBRELLA | |
integer TRIANGLE_LEFT | |
integer SQUARE_SMALL | |
integer CLOCK11 | |
integer GO_RIGHT | |
integer CLOCK6 | |
integer ARROW_SE | |
integer DIAMOND_SMALL | |
integer CHESSBOARD | |
integer FABULOUS | |
integer ARROW_NE | |
integer CLOCK1 | |
integer YES | |
integer CLOCK8 | |
integer GO_DOWN | |
integer CLOCK5 | |
integer SILLY | |
integer ANGRY | |
integer GO_UP | |
integer HOUSE | |
integer SQUARE | |
integer TRIANGLE | |
integer ARROW_E | |
integer GO_LEFT | |
integer SKULL | |
integer TARGET | |
integer ASLEEP | |
integer CLOCK3 | |
integer SURPRISED | |
integer ORIENTATION_DOWN | |
integer ARROW_NW | |
integer TSHIRT | |
integer CLOCK9 | |
integer NO | |
integer CLOCK7 | |
integer XMAS | |
integer ORIENTATION_LEFT | |
integer ORIENTATION_UP | |
integer TORTOISE | |
integer HEART_SMALL | |
integer ARROW_SW | |
integer CLOCK4 | |
integer ROLLERSKATE | |
integer GIRAFFE | |
integer CLOCK2 | |
integer ARROW_N | |
integer PITCHFORK | |
integer ARROW_W | |
integer CLOCK10 | |
integer STICKFIGURE | |
integer ARROW_S | |
integer HEART | |
integer SWORD | |
integer DIAMOND | |
integer MUSIC_QUAVER | |
integer DUCK | |
integer MUSIC_QUAVERS | |
integer SMILE | |
integer GHOST |
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)