Scrolling Text Code Ideas

Status
Not open for further replies.

Matt G

Member
Hello all,

I have been working on a mobile project using LEDs (WS2812s) and a T3.1. The display is a 28x5 matrix and my ultimate goal is to gain scrolling text on the display, maybe a sound visualizer with FFT and 28 buckets, and random here and there patterns. I have been working mainly with the hardware but haven't thought a lot about the software side of things.
I want to use the OctoWS2811 library and use each row of 28 on one output.

The scrolling text is the tricky part I have been trying to figure out how I would like to do it. I have an idea on using very large boolean arrays with a sense of lookup tables for each letter. This requires managing very large arrays and then making sure that memory space is released when I am finished with that array and ready to scroll a new array. I am sure this is terribly inefficient.

So I am reaching out and asking what would you guys do?
 
My code would contain the following:

  • an array to store the glyphs
  • an array to store the starting index of each glyph and its width
  • an array to store the current state of the display with some extra space at either end to store contents to be shifted onto the display area
  • a second copy of the display area array for double buffering - draw to one, then copy to the other
  • function to draw an arbitrary glyph at an arbitrary (x, y) location in a display array
  • function to shift the display array contents by an arbitrary (dx, dy), perhaps limited by the extra space in the display area array
  • function to update the LEDs using a pointer to one of the display arrays

I'd encode each column of the display in a single 8-bit byte. The convenience of being able to index into a byte array outweighs the memory savings of packing 5-bit quantities.

I'd probably write a helper program that would read in an image file and write out C++ code to initialize the glyph array and the glyph index/width array so I could create the glyphs in a paint program.
 
Status
Not open for further replies.
Back
Top