The color matrix is an external device that is connected to the hub through a port. The color matrix is a 3x3 matrix of lights where the color and brightness of each pixel can be changed to display things.
integerNone1
2
3
use Libraries.Robots.Spike.ColorMatrix
ColorMatrix cm
integer port = cm:GetPort()NoneintegerportThe port that this color matrix object will be set to
1
2
3
4
5
use Libraries.Robots.Spike.ColorMatrix
use Libraries.Robots.Spike.Port
ColorMatrix cm
Port port
cm:SetPort(port:A)NoneNone1
2
3
4
5
6
use Libraries.Robots.Spike.ColorMatrix
use Libraries.Robots.Spike.Port
ColorMatrix cm
Port port
cm:SetPort(port:A)
cm:Clear()Array<integer>integerxThe x location of the pixel, 0 to 2
integeryThe y location of the pixel, 0 to 2
1
2
3
4
5
6
7
use Libraries.Robots.Spike.ColorMatrix
use Libraries.Robots.Spike.Port
use Libraries.Containers.Array
ColorMatrix cm
Port port
cm:SetPort(port:A)
Array<integer> colorIntensity = cm:GetPixelColor(0, 0)NoneintegerxThe x location of the pixel, 0 to 2
integeryThe y location of the pixel, 0 to 2
integercolorThe color constant to set the pixel to (see Color)
integerintensityThe intensity (brightness) to set the pixel to
1
2
3
4
5
6
7
8
use Libraries.Robots.Spike.ColorMatrix
use Libraries.Robots.Spike.Color
use Libraries.Robots.Spike.Port
ColorMatrix cm
Color color
Port port
cm:SetPort(port:A)
cm:SetPixelColor(0, 0, color:RED, 100)NoneArray<integer>colorValuesAn integer array of size 9 containing the color for each pixel
Array<integer>intensityValuesAn integer array of size 9 containing the intensity for each pixel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Libraries.Robots.Spike.ColorMatrix
use Libraries.Robots.Spike.Color
use Libraries.Robots.Spike.Port
use Libraries.Containers.Array
ColorMatrix cm
Color color
Port port
Array<integer> colors
Array<integer> intensities
repeat 9 times
colors:Add(color:RED)
intensities:Add(100)
end
cm:SetPort(port:A)
cm:ShowColors(colors, intensities)