  * An alternate method of scrolling text using the dispChar() function. 
  * Essentially this method works by writing the full string of text to 
  * the display starting with it just off the right side of the screen. 
- * It then redraws each character one column to the left until the entire 
- * string has been displayed. 
+ * It then redraws each character shifted one column to the left until 
+ * the entire string has been displayed. 
  * 
  * This method is much slower, but allows you to scroll text at any Y position.
 */
-void altScrollText(){
-
+void altScrollText() {
    /* 
-    Start drawing at the first x position off the display.
-    Stop drawing at the size of text string multiplied by the font width,
-    but in the negative.
+    Start drawing at the first x position off the right side of the display.
+    Stop drawing once the entire string has scrolled off the screen.
+    (-1 x string length x font width)
    */
+   
+   // For some reason Arduino doesn't like -sizeof(), so we have to create a variable instead.
+   int strLength = sizeof(text3);
+   
    lm.setFont(FONT8x8);
-   for (int x = NUM_COLS * 8; x >= -sizeof(text)*8; x--) {
-      
-      lm.clear();       // Clear the led array of any previous data
-
-      for (int i = 0; i < sizeof(text)-1; i++) {   // Now draw each character in the string
-         
+   
+   for (int x = NUM_COLS * 8; x >= -strLength * 8; x--) {   // This loop determines where to start drawing chars
+      lm.clear();                                           // Clear the led array of any previous data
+      for (int i = 0; i < strLength-1; i++) {               // Next draw each character in the string
          /* 
-          printChar() takes 3 parameters:
-           - Character to print
-           - X position (left)
-           - Y position (top)
+          printChar(c, x, y) takes 3 parameters:
+           - c = Character to print
+           - x = Left-most X position
+           - y = Top-most Y position
           The y position will always stay the same (unless you want to try something funky)
-          The x position of each character is determined by the starting x 
-          position from the outer for loop plus the font width multiplied 
-          by its location in the text array. 
+          The x position of each character is determined by the starting x position
+          from the outer for() loop + the font width * its index in the text array. 
          */
-         lm.printChar(text[i], x + (FONT8x8 * i), 0);
+         lm.printChar(text3[i], x + (FONT8x8 * i), 0);
       }
       lm.update();      // update() must be called to redraw the display
-      delay(2);         // This sets the scroll speed
+      delay(20);        // This sets the scroll speed
    }
 
    /*

 * the screen. The spaces between characters is already accounted for.
 */
void scrollText() {
   lm.setFont(FONT8x8);
   // Loop through each character in the text[] array
   for (int i = 0; i < sizeof(text)-1; i++) {

      /* 
       * For each character, call the scrollChar() function.
       * scrollChar(char, row) has 2 arguements:
       *  - character to scroll
       *  - 8x8 dot matrix display row to scroll it on (first row = 0)
       */
      lm.scrollChar(text[i], 0);
   }

   // Second example using line 2 with 5x7 font
   lm.setFont(FONT5x7);
   for (int i = 0; i < sizeof(text)-1; i++) {
      lm.scrollChar(text[i], 1);
   }
}


#else
LedMatrix lm = LedMatrix(NUM_ROWS, NUM_COLS);
#endif

/* 
 * Enter the text you want to scroll. Leave a few blank spaces
 * at the end as an easy way to scroll off the screen.
 * I used 4 different text strings to verify each of the 4  
 * functions used is working properly.
 */
char text1[] = "Hello World 1!          ";      // scrollText() 8x8 Font
char text2[] = "Hello World 2!          ";      // scrollText() 5x7 Font
char text3[] = "Hello World 3!          ";      // altScrollText() 8x8 Font
char text4[] = "Hello World 4!          ";      // altScrollText() 5x7 Font

void setup() {
   // No setup required. Some options you can set are
   lm.scrollDelay(20);     // Sets the delay for scrolling text. 0 = fastest
   lm.setIntensity(1);     // Sets the LED intensity. Default is 1.
   lm.setFont(FONT8x8);    // Sets the char font. Either FONT8x8 (default) or FONT5x7. 
}
