Text Display and Effects - Resinchem/LED-Matrix-Clock_WS2812b GitHub Wiki

Text mode and effects are only available via MQTT commands

The basic built-in web server does not support text mode, so you cannot set the text to display or apply effects.

Setting the text display

The matrix supports two lines of text, with up to six characters per line. All ASCII characters from 32 through 120 are represented, with the following exceptions:

  • The dollar sign ($ - ASCII 36) and the ampersand (& - ASCII 38) are reserved to create a blank character
  • Letters are represented by the same character display, whether entered as upper or lower case (e.g. "B" is displayed the same, whether entered as "B" or "b"

To set the text, you issue the MQTT command: cmnd/matrix/text/message with a payload of the text to display. The first and second line are separated by the pipe | symbol. For example, to display "Sample Text" on the display, the following payload would be sent:

SAMPLE|TEXT (for letters, text is not case sensitive SAMPLE|TEXT, Sample|Text and SaMpLe|TeXt all render the same)

SampleTextLeft

If you wish to center (or even left-justify) the text, use the $ or & character to create leading spaces:

SAMPLE|&TEXT

SampleTextCenter

If you enter more than six characters for either line of text, the extra characters are simply truncated and not displayed.

Applying Text Effects

A number of effects can be applied to the displayed text. Again, this must be done via MQTT. If text is defined, then the effect is applied by issuing the following MQTT command: cmnd/matrix/text/effect with one of the following integer payload values:

Payload Text Effect Applied
0 No effect - just display the text
1 Flash - the entire text message flashes off/on
2 Flash Alternate - The first row and second row alternate flashing. Note that if only one row of text is defined, the effect will the same as Flash
3 Fade In - Text will fade in from off to current overall clock brightness level, in 5 equal steps
4 Fade Out - Text will start at current overall brightness level and fade to off, in 5 equal steps
5 Appear - Text will appear one character at a time, starting with the first character of first line
6 Appear Flash - Text will appear on character at a time, then the entire message will flash on/off three times
7 Rainbow - Each character will appear in a random color, changing every cycle

Setting Effect Speed

The speed of each of the effects can be set by issuing the following MQTT command: cmnd/matrix/text/speed

Valid payload values are an integer from 1 (slowest) to 10 (fastest). At the slowest speed of 1, the effect will "cycle" about once every 2 seconds. At the fastest speed of 10, the effect will cycle once about every 0.2 seconds. For example, if a speed of '5' is applied to the 'Flash' effect, the text will on for approximately one second and then off for approximately one second.

Additional effects may be developed and included in later releases.