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=0RIGHT=1DOWN=2LEFT=3HEART=1HEART_SMALL=2HAPPY=3SMILE=4SAD=5CONFUSED=6NonetextvalueText that will be written to the display.
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Write("Hi!")integerintegerxThe x coordinate, from 0 to 4, of the pixel
integeryThe y coordinate, from 0 to 4, of the pixel
1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
output lights:GetPixel(0,0)NoneintegerxThe x coordinate, from 0 to 4, of the pixel
integeryThe y coordinate, from 0 to 4, of the pixel
integeryThe 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)NoneArray<integer>pixelsAn 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)NoneintegerimageBuilt 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)NoneNone1
2
3
use Libraries.Robots.Spike.LightMatrix
LightMatrix lights
lights:Clear()integerNone1
2
3
use Libraries.Robots.Spike.LightMatrix
LighMatrix lights
integer orientation = lights:GetOrientation()integerintegerorientationThe 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)