Skip to content

Latest commit

 

History

History
135 lines (97 loc) · 4.18 KB

README.md

File metadata and controls

135 lines (97 loc) · 4.18 KB

ScrollingText8x8Display

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.

Download it from GitHub.

Example

Hardware

Read the tutorials below to learn how to setup a 8x8 LED display with arduino:

Software

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.

Setting up

#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);
}

Documentation

Initialize the ScrollingText8x8Display.

  • @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 be TOP_TO_BOTTOM, RIGHT_TO_LEFT, BOTTOM_TO_TOP or LEFT_TO_RIGHT. Default value is RIGHT_TO_LEFT.
  • @param characterOrientation - optional - Define the character orientation. Can be TOP, RIGHT, BOTTOM or LEFT. TOP is the normal orientation of a character. So RIGHT means the character is rotated to right. Default value is TOP.
void init(
  byte displayRowPins[],
  byte displayColumnPins[],
  ScrollingDirection scrollingDirection,
  CharacterOrientation characterOrientation);

Display a text on a 8x8 LED display.

  • @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);

Display a character on a 8x8 LED display.

  • @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);

8x8 Characters Overview

image source

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 ❤.

ScrollingDirection enumeration

enum ScrollingDirection
{
  TOP_TO_BOTTOM,
  RIGHT_TO_LEFT,
  BOTTOM_TO_TOP,
  LEFT_TO_RIGHT
};

CharacterOrientation enumeration

enum CharacterOrientation
{
  TOP,
  RIGHT,
  BOTTOM,
  LEFT
};