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

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

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

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

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()

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)

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)

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!")