The Dot Matrix (DM) Displays are comprised of 8×8 monochrome dot matrix modules joined together.
Supported display configurations:
“2×2”: comprising four 8×8 DM modules arranged in a 2×2 configuration. This results in a 16×16 DM display.
“inline”: comprising up to 8 single 8×8 DM modules in series. So the maximum DM display size accommodated is 8 dots high by 64 dots wide (64:8).
Dot Matrix coordinates are defined as x:y with the origin being x=0 and y=0 which is the physical led dot at the bottom left hand side. This accords with normal Cartesian geometry conventions and facilitates students plotting formula from code on the DM displays and calculating transition movements.
Examples:
bottom left origin is 0:0
top right of a 16×16 Dot Matrix is 15:15
matrix config
Command Syntax:
matrix config set MOSI CLK CS panel_count panel_type;
Purpose: configure the physical SPI (serial peripheral interface) pins, number of DM modules and DM display type.
Default: matrix config set 23 18 5 4 inline;
matrix config set 23 18 5 4 inline;
Notes: default uses hardware SPI pins, however if other pins are used performance will be slower and use more resources.
“panel_count”: 2, 4 or 8 panels.
“panel_type”: “inline” or “2×2”.
Example 1: set an 8 X 1 Dot Matrix Display to hardware SPI
matrix config set 23 18 5 8 inline;
Example 2: set an 2 X 2 Dot Matrix to hardware SPI
matrix config set 23 18 5 4 2x2;
Command Syntax:
matrix config save;
Purpose: saves Dot Matrix configuration to memory.
Command Syntax:
matrix config info;
Purpose: Reports currently saved DM configuration.
Command Syntax:
matrix config enable yes|no;
Purpose: enables or disables the DM display.
Command Syntax:
matrix config default;
Purpose: configure a DM display using the default settings, as above.
Command Syntax:
matrix config remove;
Purpose: removes from memory any stored DM Display configuration.
Command Syntax:
matrix config size panel_count;
Purpose: configure the DM Display with specified number of DM modules.
Command Syntax:
matrix config type panel_type;
Purpose: configure the DM Display with specified DM module orientation i.e. “panel_type” being “inline” or “2×2”.
Command Syntax:
matrix config startup startup_number;
Purpose: runs startup animation- “0” is none.
matrix clear
Command Syntax:
matrix clear;
OR
matrix;
Purpose: turns all the LED dots off i.e. clears the display of all illumination
matrix flash
Command Syntax:
matrix flash;
Purpose: Quickly turns all the LED dots on then clears i.e. flashes all LED dots.
matrix demo
Command Syntax:
matrix demo [value];
Purpose: displays a demonstration animation- currently 1 to 2.
Example 1: Display demo 2 on the Dot Matrix display.
matrix demo 2;
Example 2: Display default demo on the Dot Matrix display.
matrix demo;
matrix random
Command Syntax:
matrix random;
Purpose: Draws random lines in an infinite loop until commanded otherwise.
matrix up|down|left|right
Command Syntax:
matrix up|down|left|right;
Purpose: shifts image one pixel in the specified direction.
Example 1: Shift image 1 pixel to the left.
matrix left;
matrix bright
Command Syntax:
matrix bright value;
Purpose: sets the luminosity (0-100) or brightness or the pixels that are “on”.
Example 1: Set the image to half brightness
matrix bright 50;
matrix point
Command Syntax:
matrix point x y on|off;
Purpose: Turns an individual LED dot on or off at the specified coordinate
Example 1: turn on dot at middle of a 16×16 DM.
matrix point 7 7 on;
Example 2: turn on origin of any size DM i.e. the 1st dot in x and y.
matrix point 1 1 on;
Example 3: turn on the 2nd dot in and up of any size DM.
matrix point 2 2 on;
matrix line
Command Syntax:
matrix line x1 y1 x2 y2;
Purpose: Draws a line i.e. illuminates the dots between the two specified coordinates.
Example 1: Draw a line from the origin to midpoint of a 16×16 DM.
matrix line 1 1 8 8;
matrix rectangle
Command Syntax:
matrix rectangle x1 y1 x2 y2 on|off;
Notes: The rectangle fill can be either “on” or “off” i.e. last parameter.
Example 1: Draw a non-filled rectangle on the periphery of a 16×16 DM.
matrix rectangle 1 1 16 16 off;
Example 2: Draw a filled rectangle one dot in from the boundary on a 16×16 DM
matrix rectangle 2 2 15 15 on;
matrix text
Command Syntax:
matrix text speed 'your text';
Purpose: Scrolls specified text from right to left at the specified speed.
speed can be 0-9999 (milliseconds between updates) or “slow”, “medium”, “fast”
Example 1: Scroll text “medium” speed.
matrix text medium 'This is my message to scroll at medium speed';
Example 2: Scroll text with 100 milliseconds between updates.
matrix text 100 'This message refreshes every 1/10th of a second';
matrix show
Command Syntax:
matrix show #file;
Purpose: Shows stored image file number #file
where value = 0-999 i.e. 1000 images can be stored on ScratchLink.
OR
where value = hex string that must start with 0x and followed by 64 hex bytes
Example 1: Show stored image # 25 on the Dot Matrix
matrix show 25;
Example 2: Show image hex string “0x000F102040000301000018180000000000F00804020000000000303000000001”
matrix show 0x000F102040000301000018180000000000F00804020000000000303000000001;
matrix play animation
Purpose: plays a stored sequence of matrix files with the selected attributes so as to present an animation.
Command Syntax:
matrix animate START END [MS] [on];
where START is the start image number, END is the final (inclusive). MS is the time interval between images in ms, put on at the end to loop the animation indefinitely.
Example: play stored images #100 to #103 with a 100ms delay in a repeat loop.
matrix animate 100 103 100 on;
matrix save
Command Syntax:
matrix save #File;
Purpose: Saves current image as image number #File.
where value = 0-999 i.e. 1000 images can be stored on ScratchLink.
OR
where value = hex string that must start with 0x and followed by 64 hex bytes
Example: Save currently displayed image on DM as image 10.
matrix save 10;
matrix save value hex_string;
Purpose: Saves specified hex string as specified image.
Example: Save hex string 0x000F102040000301000018180000000000F00804020000000000303000000001 as image 15
matrix save 15 0x000F102040000301000018180000000000F00804020000000000303000000001;
Matrix Get
Command Syntax:
matrix get [num];
Purpose: Reports the hex code for the stored Dot Matrix bitmap for given file number.
Example: What is the hex code for the image stored at file location 27?
matrix get 27;
Will return
{mtx:[27,0×0080804040402020101010080804040000000000000000000000000000000000]}