The light matrix controls a 5x5 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.
UP=0
RIGHT=1
DOWN=2
LEFT=3
HEART=1
HEART_SMALL=2
HAPPY=3
SMILE=4
SAD=5
CONFUSED=6
None
textvalue
Text that will be written to the display.
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Write("Hi!")
integer
integerx
The x coordinate, from 0 to 4, of the pixel
integery
The y coordinate, from 0 to 4, of the pixel
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
output lights:GetPixel(0,0)
None
integerx
The x coordinate, from 0 to 4, of the pixel
integery
The y coordinate, from 0 to 4, of the pixel
integery
The intensity, from 0 to 100, that the pixel will be set to
1
2
3
4
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:SetPixel(0,0,100)
lights:SetPixel(4,4,100)
None
Array<integer>pixels
An integer array of pixels to display, where each index represents the intensity from 0 to 100 of the corresponding pixel. The order is left to right, top to bottom on a 5x5 grid.
1
2
3
4
5
6
7
8
9
10
11
use Libraries.Robots.Spike.LightMatrix
use Libraries.Containers.Array
Array pixels
LightMatrix lights
integer i = 0
repeat 25 times
pixels:Add(i)
i = i + 4
end
lights:Show(pixels)
None
integerimage
Built in image to display; should be one of the constant values of LightMatrix
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:ShowImage(1)
None
None
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Clear()
integer
None
1
2
3
use Libraries.Robots.Spike.LightMatrix
LighMatrix lights
integer orientation = lights:GetOrientation()
integer
integerorientation
The direction to orient the light matrix, defined as a value from 0 to 3 (UP, RIGHT, DOWN, LEFT).
1
2
3
use Lsibraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:SetOrientation(lights:UP)