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.
integer
None
1
2
3
use Libraries.Robots.Spike.ColorMatrix
ColorMatrix cm
integer port = cm:GetPort()
None
integerport
The 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)
None
None
1
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>
integerx
The x location of the pixel, 0 to 2
integery
The 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)
None
integerx
The x location of the pixel, 0 to 2
integery
The y location of the pixel, 0 to 2
integercolor
The color constant to set the pixel to (see Color)
integerintensity
The 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)
None
Array<integer>colorValues
An integer array of size 9 containing the color for each pixel
Array<integer>intensityValues
An 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)