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

Thread: OctoWS2811 and scrolling text

  1. #1
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924

    OctoWS2811 and scrolling text

    Hello there, this was originally posted in the thread on FastSpi as I could not see the 'post new thread' button, right in front of me. I have now deleted it from there.

    I have put together a short adapted piece of code using octows2811 to manage scrolling text by using an index array for alphabet characters. The code just uses a text string as input, grabs the characters in turn, uses the alphabet 2D array to return Hex values describing the column of leds being either on or off, and then movs the whole array on one.

    the nuts and bolt are:
    Code:
    ////Start of message setup////
      char msg[] = "Hi, this is a test for OctoWS2811. Scrolling text using a character lookup table for alphabet. # $ @ * etc...  ";
    
      for (int charIndex=0; charIndex < (sizeof(msg)-1); charIndex++) //start of charIndex setup
      { 
        int  alphabetIndex = msg[charIndex]- ' ';
        if (alphabetIndex < 0) alphabetIndex=0;
     bool isOn =0;
      for (int col=0; col<6;col++) {
    //////////START OF SET METHOD/////////////////
     for(int row=0; row<rows ;row++){
       if (col<5) isOn = bitRead( alphabets[alphabetIndex][col], row ) == 1;
    leds.setPixel(pix[row],isOn*50);
    leds.show();delay(del);
      }
    ///////////START OF THE SCROLL METHOD/////////////////////
    for(int a=0; a<8; a++){
      for(int b=1; b<34;b++){
    leds.setPixel(array[a][b]-1,leds.getPixel(array[a][b]));}
    }
    ////////END OF SET AND SCROLL////////////////////
        }
      }//end of charindex setup
    }//end of message setup
    The pix array just sets out the starting location for the first column of leds (the right hand most location).

    The 2D array array[][] is a way of housing the pixel/led reference numbers.

    the alphabet array is the usual 2D situation, and uses one I found online. Really sorry, but cant find it again to be able to give credit where it is due:
    Code:
    byte alphabets [96] [5]  = {
      { 0x00, 0x00, 0x00, 0x00, 0x00 }, // space  (0x20)
      { 0x00, 0x00, 0x2F, 0x00, 0x00 }, // !
      { 0x00, 0x07, 0x00, 0x07, 0x00 }, // "
    I think that the original code using digital write for pins came from here: http://arduino.cc/forum/index.php/topic,8672.0.html

    there is a vid at http://orchardelica.com/wp/

    any comments on optimising code would be appreciated.

    mortonkopf
    Last edited by mortonkopf; 05-03-2013 at 08:24 AM.

  2. #2
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924
    So, finally managed to get the scrolling text octows2811 set up into the top hat running off 4 x 1.5v rechargables and using a button at the back to change the mode (it also does various patterns), just in time for an upcoming festival.

    there is a vid at http://orchardelica.com/wp/

    hope you like it
    mortonkopf

  3. #3
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924
    Hi,
    If you are interested, I have posted the code to get the scrolling text up and running on OctoWS2811 here:

    http://orchardelica.com/wp/?page_id=170

    Thanks to John for helping with some optimisation and getting rid of that big array.
    mortonkopf

Tags for this Thread

Posting Permissions

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