Matrix 16 X 32 scroll text

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Oliver123
 
Posts: 1
Joined: Tue Oct 28, 2014 9:43 pm

Matrix 16 X 32 scroll text

Post by Oliver123 »

Hello I want to know how to scroll text, I am trying to send text by a bluetooth and I did it, but now I want the text to scroll.

Code: Select all

#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library


#define CLK 11  // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE  9
#define A   A0
#define B   A1
#define C   A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);

char dato;
String readString;
void setup() {
  Serial.begin(9600);
  Serial3.begin(9600);
    matrix.begin();
}

void loop() {
  leer_Dato(); {
    if (readString.length()>0){
        // fill the screen with 'black'
 matrix.fillRect(0, 0, 32, 16, matrix.Color333(0, 0, 0));
      
   // draw some text!
  matrix.setCursor(1, 0);   // start at top left, with one pixel of spacing
  matrix.setTextSize(1);    // size 1 == 8 pixels high
  


      matrix.print(readString);
      Serial.print(readString);
}
readString = "";
  }

}
  
void leer_Dato() {
  while (Serial3.available()){
    delay(10);
    if (Serial3.available()>0){
      dato = Serial3.read();
      readString += dato;
    }
  }
}
Last edited by adafruit_support_rick on Wed Nov 26, 2014 1:14 pm, edited 1 time in total.
Reason: please use code tags (</> button)when posting code

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Matrix 16 X 32 scroll text

Post by adafruit_support_rick »

What you want to do is keep changing the starting location (setCursor) to move it to the left, and then rewrite the string. So the first time you set the cursor to (1,0). The next time you might set the cursor to (-1,0), and then to (-3,0), etc.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”