Skip to content

4.Text Array & Special Character Codes

Aaron Liddiment edited this page Nov 9, 2015 · 1 revision

The text array obviously contains the text you wish to see displayed but can also contain special character codes which will allow you to change colours, character direction, scrolling direction, frame rate, delays and background mode. The special character codes you can use are defined in the LEDText.h header file and all start with EFFECT_. If there are parameters for a special code they are in hexadecimal.

EFFECT_CUSTOM_RC "\xNN" This is used to set the return value of the UpdateText() call. It can be used so that when certain parts of the message are reached other events can be triggered by checking for certain return codes.

EFFECT_BACKGND_ERASE
This will change the background mode so that all the '0' bits in the font data cause the corresponding LED's within the initialised message area to be turned off.

EFFECT_BACKGND_LEAVE
This will change the background mode so that all the '0' bits in the font data will leave the corresponding LED's unmodified.

EFFECT_BACKGND_DIMMING "\xNN"
This will change the background mode so that all the '0' bits in the font data will have the corresponding LED's brightness scaled down by NN 256ths using FastLED's nscale8_video.

EFFECT_FRAME_RATE "\xNN"
This sets a rate for the frame animation in that if NN is 04, it will be every 5th call to UpdateText() that the pixel position is moved. The default value is 0 which means every call will update the pixel position.

EFFECT_DELAY_FRAMES "\xHH\xLL"
This will pause the animation for ((HH * 256) + LL) calls to UpdateText().

EFFECT_SCROLL_LEFT
EFFECT_SCROLL_RIGHT
EFFECT_SCROLL_UP
EFFECT_SCROLL_DOWN
This will cause the scroll direction to change. With a change of scroll direction any existing text will be scrolled off the message area before the new direction is applied unless the INSTANT_OPTIONS_MODE has been set.

EFFECT_CHAR_UP
EFFECT_CHAR_DOWN
EFFECT_CHAR_LEFT
EFFECT_CHAR_RIGHT
This changes the font rendering to be in the chosen direction.

EFFECT_RGB "\xRR\xGG\xBB"
EFFECT_HSV "\xHH\xSS\xVV"
Changes the solid colour of the text using either RGB or HSV method.

EFFECT_RGB_CV "\xRR\xGG\xBB\xRR\xGG\xBB"
EFFECT_HSV_CV "\xHH\xSS\xVV\xHH\xSS\xVV"
Sets a graduated colour range for the text over a single character height. The first triple is the bottom and the second triple is the top.

EFFECT_RGB_AV "\xRR\xGG\xBB\xRR\xGG\xBB"
EFFECT_HSV_AV "\xHH\xSS\xVV\xHH\xSS\xVV"
Sets a graduated colour range for the text over the message area height. The first triple is the bottom and the second triple is the top.

EFFECT_RGB_CH "\xRR\xGG\xBB\xRR\xGG\xBB"
EFFECT_HSV_CH "\xHH\xSS\xVV\xHH\xSS\xVV"
Sets a graduated colour range for the text over a single character width. The first triple is the left side and the second triple is the right side.

EFFECT_RGB_AH "\xRR\xGG\xBB\xRR\xGG\xBB"
EFFECT_HSV_AH "\xHH\xSS\xVV\xHH\xSS\xVV"
Sets a graduated colour range for the text over the message area width. The first triple is the left edge and the second triple is the right edge.

EFFECT_COLR_EMPTY
Any '1' bits in the font data will leave the corresponding LED's unmodified. Tip - This is useless with EFFECT_BACKGND_LEAVE !

EFFECT_COLR_DIMMING "\xNN"
Any '1' bits in the font data will have the corresponding LED's brightness scaled down by NN 256ths using FastLED's nscale8_video. Tip - Useful only when you have data already in the LED array.

Extreme example ;)
const unsigned char TxtDemo[] = {
EFFECT_SCROLL_LEFT " LEFT SCROLL "
EFFECT_SCROLL_RIGHT " LLORCS THGIR"
EFFECT_SCROLL_DOWN " SCROLL DOWN SCROLL DOWN "
EFFECT_FRAME_RATE "\x04" " SCROLL DOWN "
EFFECT_FRAME_RATE "\x00" " "
EFFECT_SCROLL_UP " SCROLL UP SCROLL UP "
EFFECT_FRAME_RATE "\x04" " SCROLL UP "
EFFECT_FRAME_RATE "\x00" " "
EFFECT_CHAR_UP EFFECT_SCROLL_LEFT " UP"
EFFECT_CHAR_RIGHT " RIGHT"
EFFECT_CHAR_DOWN " DOWN"
EFFECT_CHAR_LEFT " LEFT"
EFFECT_HSV_CV "\x00\xff\xff\x40\xff\xff" EFFECT_CHAR_UP " HSV_CV 00-40"
EFFECT_HSV_CH "\x00\xff\xff\x40\xff\xff" " HSV_CH 00-40"
EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " HSV_AV 00-40"
EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " HSV_AH 00-FF"
" "
EFFECT_HSV "\x00\xff\xff" "R"
EFFECT_HSV "\x20\xff\xff" "A"
EFFECT_HSV "\x40\xff\xff" "I"
EFFECT_HSV "\x60\xff\xff" "N"
EFFECT_HSV "\xe0\xff\xff" "B"
EFFECT_HSV "\xc0\xff\xff" "O"
EFFECT_HSV "\xa0\xff\xff" "W"
EFFECT_HSV "\x80\xff\xff" "S "
EFFECT_DELAY_FRAMES "\x00\x96"
EFFECT_RGB "\xff\xff\xff" };

Clone this wiki locally