Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Scrolling Text Code Ideas

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Location
    West Virginia
    Posts
    6

    Scrolling Text Code Ideas

    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?

  2. #2
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    700
    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.

  3. #3
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354
    Mortonkopf has some good ideas for scrolling text on his blog: http://orchardelica.com/wp/octows281...text-full-code
    I was able to implement this without much trouble.

    If I didn't say so earlier, Thanks MortonKopf
    Last edited by Wozzy; 04-10-2014 at 11:31 AM.

  4. #4
    Junior Member
    Join Date
    Feb 2014
    Location
    West Virginia
    Posts
    6
    Quote Originally Posted by Wozzy View Post
    Mortonkopf has some good ideas for scrolling text on his blog: http://orchardelica.com/wp/octows281...text-full-code
    I was able to implement this without much trouble.

    If I didn't say so earlier, Thanks MortonKopf
    That's a great starting point, Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •