// Import the libraries
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

// Pin for data
#define PIN 15

// Declare the LED matrix object
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, 4, 1, PIN, NEO_TILE_TOP | NEO_TILE_TOP | NEO_TILE_LEFT | NEO_TILE_COLUMNS | NEO_TILE_PROGRESSIVE | NEO_MATRIX_TOP | NEO_MATRIX_LEFT | NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800);

// Declare a list of colors
const uint16_t colores[] = {matrix.Color(255, 0, 0),
                            matrix.Color(255, 0, 0),
                            matrix.Color(0, 0, 255)};

void setup() {
  Serial.begin(115200);
  matrix.begin();
  matrix.setBrightness(40);
  matrix.setTextColor(colores[0]);
}

int16_t x = matrix.width();
int pass = 0;

void loop() {
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);
  matrix.print("Hola mundo");
  if (--x < -32) {
    x = matrix.width();
    if (++pass >= 3) pass = 0;
    matrix.setTextColor(colores[pass]);
  }
  matrix.show();
  delay(100);
}