This library allows you to display a scrolling text on a 8x8 LED display.
You can set the scrolling speed, the scrolling direction and also the character orientation.
Read the tutorials below to learn how to setup a 8x8 LED display with arduino:
To install, copy the ScrollingText8x8Display folder into your arduino sketchbook-libraries folder. More detailed instructions are here. The Library Manager can be used from arduino version 1.6.2.
#include "ScrollingText8x8Display.h"
ScrollingText8x8Display render;
void setup()
{
byte displayRowPins[] = {2, 3, 4, 5, A3, A2, A1, A0}; // Ps: ``A3 = 17; A2 = 16; A1 = 15; A0 = 14;``
byte displayColumnPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
ScrollingDirection scrollingDirection = RIGHT_TO_LEFT;
CharacterOrientation characterOrientation = TOP;
render.init(displayRowPins, displayColumnPins, scrollingDirection, characterOrientation);
}
void loop()
{
render.displayText("Hello");
render.displayText(" World!");
render.displayText(" ");
float scrollingSpeed = 55.5;
render.displayText("slow.... text!", scrollingSpeed);
}
- @param
displayRowPins
- is an array that stores the arduino pin numbers of the corresponding row pins of the 8x8 LED display. see the picture below. See "matrix of the pin connections" table in the Arduino Lesson - 8x8 LED display tutorial. - @param
displayColumnPins
- is an array that stores the arduino pin numbers of the corresponding column pins of the 8x8 LED display. See "matrix of the pin connections" table in the Arduino Lesson - 8x8 LED display tutorial. - @param
scrollingDirection
- optional - Define the scrolling direction. Can beTOP_TO_BOTTOM
,RIGHT_TO_LEFT
,BOTTOM_TO_TOP
orLEFT_TO_RIGHT
. Default value isRIGHT_TO_LEFT
. - @param
characterOrientation
- optional - Define the character orientation. Can beTOP
,RIGHT
,BOTTOM
orLEFT
.TOP
is the normal orientation of a character. SoRIGHT
means the character is rotated to right. Default value isTOP
.
void init(
byte displayRowPins[],
byte displayColumnPins[],
ScrollingDirection scrollingDirection,
CharacterOrientation characterOrientation);
- @param
text
- The text to be displayed. - @param
scrollingSpeed
- optional - The scrolling speed is between 1.0 (lowest speed) and 100.0 (highest speed). 90.0 is the default value.
void displayText(String text, unsigned long scrollingSpeed);
- @param
index
- The index of the character to be displayed. The value is between 0 (0x00) and 255 (0xFF). You can find the characters corresponding to each index in the section below: - @param
scrollingSpeed
- optional - The scrolling speed is between 1.0 (lowest speed) and 100.0 (highest speed). 90.0 is the default value.
void displayCharacter(int index, unsigned long scrollingSpeed);
To know the index of a character we combine the column index with the row index. Both column and row index are hexadecimal values.
For example the heart ❤ (column index: 0x and row index: x3) is at index 0x03.
int heartIndex = 0x03;
render.displayCharacter(heartIndex); // display a scrolling heart ❤.
enum ScrollingDirection
{
TOP_TO_BOTTOM,
RIGHT_TO_LEFT,
BOTTOM_TO_TOP,
LEFT_TO_RIGHT
};
enum CharacterOrientation
{
TOP,
RIGHT,
BOTTOM,
LEFT
};