Arduino Scrolling Text v2.0 – With direction and speed control!

//Arduino Scrolling Text v2.0 – With direction and speed control!

MAX7219 LED matrix Arduino scrolling text with ‘LIVE’ speed and direction control!


All my content is free.

If you feel that my videos are helping and you would like to contribute, you can toss some coins in the Tip Jar via PayPal.

Select amount then click the “Donate” button.

Brainy-Bits Tip Jar Amount

Quite a while ago, I did a tutorial on how to create Scrolling Text using a MAX7219 LED Matrix and an Arduino.

It worked, but the library I used at the time was very limited and hard to modify how the text scrolls across multiple matrix modules.

So I decided to make this new tutorial but this time using a more flexible library which provides more options.

The library in question is the ‘Parola’ library by MajicDesigns.

In this tutorial I will use six MAX7219 LED matrix linked together with a slider potentiometer to control the direction and speed of the scrolling text in real time.


Max7219 Matrix Arduino

The MAX7219 modules I’m using, have two sets of five pins, IN and OUT, you connect IN pins of the first module to the Arduino and then connect the OUT pins to the IN pins of another modules.

The MAX7219 matrix modules communicate using the SPI protocol so we need to use specific pins.  Since we are using the Arduino UNO for this tutorial the SPI pins are located at 10 (SS), 11 (MOSI) and 13 (SCK).

These modules by themselves don’t require much current, about 150mA, but we are using six of them in this tutorial, and when all the Led’s are lit up, the current goes up to 900mA, so we need to use an external 5V power supply.

*note: The UNO if powered by USB can supply up to 500mA, if you power it using the DC jack with an external power supply, it can supply up to 1Amp.  Since 900mA is pretty close to the limit, I decided to power the Matrix module with an external 5V 2A power supply separate from the UNO which I powered using a simple USB cable from my computer.

The Slider potentiometer has two sets of 3 pins, (OTA and OTB), both set do the same thing and you can use any one of them.

The connections are as follow:

For the Slider:

5V and GND of the UNO are going to VCC and GND of the OTA set of the Slider.

A0 of the UNO connects to the OTA of the Slider.

For the LED Matrix we are using the IN pins of the right most module:

Pin 10 (SS) of the UNO is connected to right most Matrix CS pin.

Pin 11 (MOSI) is connected to the DIN pin.

and pin 13 (SCK)is connected to the CLK pin.

After that the OUT pins of one Matrix is connected with jumpers to the IN pins of the next module.


The Parola library as a dependency and requires additional library MD_MAX72xx Arduino library

This library has support for many different types or models of LED Matrix.

So you need to edit the library file to set the right setting to select the Led Matrix you are using.

For more information on what file to edit in the library have a look at the tutorial video.


To simplify the code, instead of using the Serial Monitor to enter the desired text to be displayed on the Led Matrix, we will enter the message to be displayed inside the code itself.

The slider pot value is used to decide the direction and speed of the scrolling.  When it sits in the middle the text will scroll slowly, if we move it to the right or left, then the text will start scrolling in that direction and the more we slide the speed will be increased.

The Parola library has many many more options you can experiment with, like fading, scrolling up and down, so I invite you to take a more in depth look at all the options available if you want to experiment further.

As always for more information about the tutorial and explanation of the code please watch our tutorial video.

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

#define MAX_DEVICES 6  // Number of modules connected
#define CLK_PIN   13   // SPI SCK pin on UNO
#define DATA_PIN  11   // SPI MOSI pin on UNO
#define CS_PIN    10   // connected to pin 10 on UNO

#define slider_pin A0  // OTA or OTB pin on slider
int slider_val;  // used to hold the slider analog value
int slide_scroll_speed;   // used when changing scroll speed

MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);  // SPI config

int scrollSpeed;    // used to set text scroll speed in Parola at start

// sets scrolling direction if slider in middle at start
textEffect_t scrollEffect = PA_SCROLL_LEFT;

textPosition_t scrollAlign = PA_LEFT;  // how to aligh the text

int scrollPause = 0; // ms of pause after finished displaying message

#define	BUF_SIZE	75  // Maximum of 75 characters
char curMessage[BUF_SIZE] = { "Brainy-Bits" };  // used to hold current message

void setup()

  pinMode(slider_pin, INPUT);
  P.begin();  // Start Parola
  // configure Parola
  P.displayText(curMessage, scrollAlign, scrollSpeed, scrollPause, scrollEffect, scrollEffect);


void loop() {

  slider_val = analogRead(A0);  // check slider analog value
  if (slider_val > 600) {  // if slider to the left
    scrollEffect = PA_SCROLL_LEFT;  // Change direction to Left
    P.setTextEffect(scrollEffect, scrollEffect); // set new direction in Parola (OLD, NEW)
    slide_scroll_speed = map(slider_val, 1023, 0, 15, 400); // map slider value to text scroll speed
    P.setSpeed(slide_scroll_speed);  // Set new text scroll speed
  if (slider_val < 350) {  // if slider to the right
    scrollEffect = PA_SCROLL_RIGHT;
    P.setTextEffect(scrollEffect, scrollEffect);  
    slide_scroll_speed = map(slider_val, 1023, 0, 400, 15);

  if (slider_val < 600 && slider_val > 350) {  // if slider in middle
    slide_scroll_speed = 500;

  if (P.displayAnimate()) // If finished displaying message
    P.displayReset();  // Reset and display it again

Copy the above Sketch code you want to use above in your Arduino IDE software to program your Arduino.

Don’t forget to make the necessary modification in the MD_MAX72xx library file to reflect the type of module you are using.

Download the Parola Library created by MajicDesigns:

Download the MD_MAX72xx Library created by MajicDesigns:

By | 2018-03-03T14:35:40-05:00 February 19th, 2018|Tutorials|


  1. Farah Haddad April 11, 2020 at 2:43 pm - Reply

    This is the code I used to make it easy

    void loop()
    sprintf_P(curMessage, (PGM_P)F(” Date: %02d / %02d / %04d”),, now.month(), now.year());

    if (P.displayAnimate()) // If finished displaying message
    sprintf_P(curMessage, (PGM_P)F(“Time: %02d : %02d : %02d”), now.hour(), now.minute(), now.second());
    P.displayReset(); // Reset and display it again

  2. Farah April 11, 2020 at 2:41 pm - Reply

    Amazing, this is the cleanest and best project I’ve seen, Not many thought of changing the text. However, I am stuck with something, I am want to show multiple texts, in fact I want to scroll the date then scroll the time then scroll the temperature outside then the humidity,,.etc. I am not able to figure out how to handle this in the void Loop, how can I handle this, i.e. scroll the date and check when it is finished then scroll the time, then when it is finished scroll the temperature. I am sure a structural if statement is needed but I can’t crack it

  3. John Poster June 9, 2019 at 6:48 pm - Reply

    I tried to get this scrolling text going today and those matrix types are not changed in the library anymore. They used an enum in the library where you can see the type names but I had to change it in the example itself in a line as here: #define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW

  4. John March 2, 2019 at 1:23 am - Reply

    Works fine with Arduino nano also but the one I’ve got needs Processor ATmega328P (Old Bootloader)

    Scrolling works great with any potentiometer that exceeds 22k(to reduce current)

  5. mujassam October 26, 2018 at 12:01 am - Reply

    this is the old library file plz show edit suggestion in the new file of md max72xx file

  6. Malcolm October 24, 2018 at 2:28 pm - Reply

    I have the MD_MAX72xx.h file but the #define USE_PAROLA_HW nor the #define USE_FC16_HW appear in the text.
    But I have found this:

    enum moduleType_t
    PAROLA_HW, ///< Use the Parola style hardware modules.
    GENERIC_HW, ///< Use 'generic' style hardware modules commonly available.
    ICSTATION_HW, ///< Use ICStation style hardware module.
    FC16_HW ///< Use FC-16 style hardware module.

    Do I need to change the values here?

  7. Malcolm October 22, 2018 at 11:25 am - Reply

    The text is scrolling vertically. how can I modify the code to get it to scroll horizontally?

  8. Wilbert June 24, 2018 at 12:13 pm - Reply

    Sir I am a big fan of yours but can I use my own DIY module 8×32 max7219 module, and your code doesn’t compile on my system, error saying “no matching function for call to MD_Parola(int, int)'” pls help and reply me on my [email protected] [email protected]

  9. bils June 12, 2018 at 10:15 am - Reply

    hi guys i dont know if this problem is known but in my case its written in mirror effect and dosnt go on the four max7219 it goes one by one and i dont know how to fix it thx in advance for the help

  10. Hendrik May 8, 2018 at 3:35 am - Reply

    Sir, Iam newbe here…when compiling your sketch I get error message like below:

    C:\Program Files (x86)\Arduino\libraries\MD_Parola-master\src\MD_Parola.cpp: In member function ‘void MD_Parola::begin(uint8_t)’:
    C:\Program Files (x86)\Arduino\libraries\MD_Parola-master\src\MD_Parola.cpp:67:17: error: ‘nullptr’ was not declared in this scope
    C:\Program Files (x86)\Arduino\libraries\MD_Parola-master\src\MD_Parola.cpp: In member function ‘virtual size_t MD_Parola::write(const uint8_t*, size_t)’:
    C:\Program Files (x86)\Arduino\libraries\MD_Parola-master\src\MD_Parola.cpp:132:14: error: ‘nullptr’ was not declared in this scope
    if (psz == nullptr) return(0);
    Error compiling.

    Please help to solve this error please….

  11. Ralf Lockstädt March 19, 2018 at 10:15 am - Reply

    Hello, today I have tried on several sketches with Parola. (Orginal from the Parola examples) All ran on the Arduino Nano …. unfortunately, the font and the characters were all mirrored. What am I doing wrong ?
    Thanks in advance for the answers Greetings from Berlin Ralf

  12. mic March 3, 2018 at 7:21 am - Reply

    Thank you for this tutorial.
    You have three different connections in your Tutorail – and nothing fitsd for me.
    The picture shows 10,11,12
    Your Sourcecode uses 10,11,13
    Your Text shows 10,12,13.
    Please could you clarify this please?

    • brainy-bits March 3, 2018 at 2:39 pm - Reply

      Thanks for pointing that out, I’ve updated the Connection picture and the text to reflect what was in the code which is the correct connections. Pin 10 of the UNO goes to CS pin on the Matrix, pin 11 goes to DIN and pin 13 goes to CLK.

  13. Suraj Bera February 27, 2018 at 9:12 am - Reply

    Can we use Potentiometer in place of Slider to give the scrolling effect?

    • brainy-bits February 27, 2018 at 2:39 pm - Reply

      Sure no problem. The slider I use in the tutorial is basically a Potentiometer but in another format.

Leave A Comment