8x8 RGB LED Matrix
Control pixel(s) color of 8x8 RGB LED Matrix
Add-On Required: This feature requires the Simulink Support Package for Raspberry Pi Hardware add-on.
Libraries:
Simulink Support Package for Raspberry Pi Hardware /
Sense HAT
Description
Control the pixel(s) color of the 8x8 RGB LED matrix. You can use the block either in ‘Write Pixel’ mode or the ‘Display Image’ mode.
Write Pixel Mode
To set a pixel to a specified RGB value at a location, set the block to ‘Write Pixel’ mode. Provide the RGB value and the location in terms of row and the column for each pixel.
An example of how the ‘Write Pixel’ mode works for this block is shown in the table below.
Location [row,column] | RGB [red,green,blue] | Output |
---|---|---|
[1,1] —> single pixel location | [255,0,0] —> single pixel color | Pixel at [1,1] is set to Red |
[1,1;1,2;1,3] —> 3 pixels (multiple pixel locations) | [255,0,0] —> single color for all the pixels | Pixels at [1,1], [1,2] and [1,3] are set to Red |
[1,1;1,2;1,3] —> 3 pixels (multiple pixel locations) | [255,0,0; 255,255,255; 0,0,255] —> 3 colors (multiple colors) | Pixel at 1,1 to Red Pixel at 1,2 to White Pixel at 1,3 to Blue |
Note
While setting multiple colors, if the number of colors is not equal to the number of pixels, then the first color that you provide is set to all the pixels.
Display Image Mode
To display an image on the LED matrix, set the block to ‘Display Image’ mode.
By setting the Input Image source parameter
to One multidimensional signal
, you can
provide the image to be displayed as a [8x8x3] signal to the ‘Image’
input port.
Input image as a single [8x8x3] multidimensional signal
By setting the Input Image source parameter
to Separate color signals
, you can provide
the image to be displayed as three [8x8] separate color signals to
the ‘R’, ‘G’, and ‘B’ input ports.
Input image as 3 separate [8x8] signals
You can rotate the image displayed on the LED matrix by specifying the Orientation. The image can be oriented at 0, 90, 180, or 270 degrees. You can orientate the image. For any other value you give to the image orientation, the block defaults the image orientation to 0 degree.
By setting the Orientation source parameter
to Block dialog
, you can select orientation
on the block mask in the Orientation parameter.
Setting the Orientation source parameter
to Input port
grows an additional input
port ‘Orient’. You can provide the desired orientation
to this port. If the value of this signal is other than 0,90,180,
or 270, the orientation value defaults to 0.
Image orientation on LED Matrix
Ports
Input
Parameters
Version History
Introduced in R2017a