// Adafruit_NeoMatrix example for single NeoPixel Shield.
// Scrolls 'Howdy' across the matrix in a portrait (vertical) orientation.
#include <Adafruit_GFX.h>
#include <FastLED.h>
#include <FastLED_NeoMatrix.h>
//#include <Fonts/Tiny3x3a2pt7b.h>
//#include <Fonts/Picopixel.h>
//#include <Fonts/FreeSerif9pt7b.h>
//----------------------------------------
const uint8_t zx_spectrum3pt7bBitmaps[] PROGMEM = {
0x00, 0xE8, 0xB4, 0x57, 0xD5, 0xF5, 0x00, 0x4F, 0xCF, 0xF4, 0x8C, 0x4D,
0xD8, 0x80, 0x43, 0x11, 0xF6, 0x80, 0xC0, 0x6A, 0x40, 0x95, 0x80, 0xA4,
0xFA, 0x21, 0x3E, 0x40, 0x60, 0xF0, 0xC0, 0x12, 0x48, 0x74, 0xEB, 0x97,
0x00, 0x65, 0x08, 0x4F, 0x80, 0x74, 0x43, 0x4F, 0x80, 0x74, 0x4D, 0x17,
0x00, 0x10, 0xCD, 0x3F, 0x10, 0xFC, 0x3D, 0x17, 0x00, 0x74, 0x3D, 0x17,
0x00, 0xFC, 0x10, 0x84, 0x20, 0x74, 0x5D, 0x17, 0x00, 0x74, 0x62, 0xF7,
0x00, 0xA0, 0x41, 0x80, 0x69, 0xFF, 0xAE, 0x74, 0x44, 0x42, 0x00, 0x75,
0x77, 0xF7, 0x00, 0x74, 0x63, 0xF8, 0x80, 0xF4, 0x7D, 0x1F, 0x00, 0x74,
0x61, 0x17, 0x00, 0xE4, 0xA3, 0x2E, 0x00, 0xFC, 0x3D, 0x0F, 0x80, 0xFC,
0x3D, 0x08, 0x00, 0x74, 0x61, 0x37, 0x00, 0x8C, 0x7F, 0x18, 0x80, 0xF9,
0x08, 0x4F, 0x80, 0x08, 0x43, 0x17, 0x00, 0x94, 0xB9, 0x28, 0x80, 0x84,
0x21, 0x0F, 0x80, 0x8E, 0xEB, 0x18, 0x80, 0x8E, 0x6B, 0x78, 0x80, 0x74,
0x63, 0x17, 0x00, 0xF4, 0x63, 0xE8, 0x00, 0x74, 0x63, 0x57, 0x00, 0xF4,
0x63, 0xE9, 0x80, 0x74, 0x1D, 0x17, 0x00, 0xFE, 0x20, 0x40, 0x81, 0x00,
0x8C, 0x63, 0x17, 0x00, 0x8C, 0x62, 0xA2, 0x00, 0x8C, 0x63, 0x55, 0x00,
0x85, 0x23, 0x12, 0x84, 0x82, 0x88, 0xA0, 0x81, 0x00, 0xF8, 0x88, 0x8F,
0x80, 0xF2, 0x4E, 0x84, 0x21, 0xE4, 0x9E, 0xFC, 0x7F, 0xD9, 0xFC, 0xFE,
0xFC, 0x7F, 0xD9, 0xFC, 0x61, 0xF7, 0x88, 0xE9, 0xE0, 0x78, 0x87, 0x11,
0x79, 0x70, 0x69, 0xE7, 0x73, 0x48, 0x79, 0x17, 0x60, 0x88, 0xE9, 0x90,
0x43, 0x2E, 0x10, 0x11, 0x96, 0x8A, 0xCA, 0x90, 0x92, 0x46, 0xD5, 0x6B,
0x50, 0xE9, 0x99, 0x69, 0x96, 0xE9, 0x8E, 0x80, 0x74, 0x84, 0xE1, 0x80,
0x78, 0x88, 0x68, 0x7E, 0x4E, 0x44, 0x30, 0x99, 0x96, 0x99, 0x60, 0x8D,
0x6A, 0xA0, 0x96, 0x69, 0x99, 0x17, 0x60, 0xF2, 0x4F, 0x39, 0x30, 0x43,
0x80, 0xF8, 0xE1, 0x06, 0x4E, 0x00, 0xB8 };
const GFXglyph zx_spectrum3pt7bGlyphs[] PROGMEM = {
{ 0, 1, 1, 7, 0, 0 }, // 0x20 ' '
{ 1, 1, 5, 7, 3, -4 }, // 0x21 '!'
{ 2, 3, 2, 7, 2, -4 }, // 0x22 '"'
{ 3, 5, 5, 7, 1, -4 }, // 0x23 '#'
{ 7, 4, 6, 7, 2, -4 }, // 0x24 '$'
{ 10, 5, 5, 7, 1, -4 }, // 0x25 '%'
{ 14, 5, 5, 7, 1, -4 }, // 0x26 '&'
{ 18, 1, 2, 7, 3, -4 }, // 0x27 '''
{ 19, 2, 5, 7, 3, -4 }, // 0x28 '('
{ 21, 2, 5, 7, 2, -4 }, // 0x29 ')'
{ 23, 4, 4, 7, 2, -3 }, // 0x2A '*'
{ 25, 5, 4, 7, 1, -3 }, // 0x2B '+'
{ 28, 2, 2, 7, 2, 0 }, // 0x2C ','
{ 29, 4, 1, 7, 2, -1 }, // 0x2D '-'
{ 30, 2, 1, 8, 3, 0 }, // 0x2E '.'
{ 31, 4, 4, 7, 2, -3 }, // 0x2F '/'
{ 33, 5, 5, 7, 1, -4 }, // 0x30 '0'
{ 37, 5, 5, 7, 1, -4 }, // 0x31 '1'
{ 41, 5, 5, 7, 1, -4 }, // 0x32 '2'
{ 45, 5, 5, 7, 1, -4 }, // 0x33 '3'
{ 49, 6, 5, 7, 0, -4 }, // 0x34 '4'
{ 53, 5, 5, 7, 1, -4 }, // 0x35 '5'
{ 57, 5, 5, 7, 1, -4 }, // 0x36 '6'
{ 61, 6, 5, 7, 1, -4 }, // 0x37 '7'
{ 65, 5, 5, 7, 1, -4 }, // 0x38 '8'
{ 69, 5, 5, 7, 1, -4 }, // 0x39 '9'
{ 73, 1, 3, 7, 2, -2 }, // 0x3A ':'
{ 74, 2, 5, 7, 2, -3 }, // 0x3B ';'
{ 76, 2, 4, 7, 3, -3 }, // 0x3C '<'
{ 77, 4, 2, 7, 2, -2 }, // 0x3D '='
{ 78, 2, 4, 7, 3, -3 }, // 0x3E '>'
{ 79, 5, 5, 7, 1, -4 }, // 0x3F '?'
{ 83, 5, 5, 7, 1, -4 }, // 0x40 '@'
{ 87, 5, 5, 7, 1, -4 }, // 0x41 'A'
{ 91, 5, 5, 7, 1, -4 }, // 0x42 'B'
{ 95, 5, 5, 7, 1, -4 }, // 0x43 'C'
{ 99, 5, 5, 7, 1, -4 }, // 0x44 'D'
{ 103, 5, 5, 7, 1, -4 }, // 0x45 'E'
{ 107, 5, 5, 7, 1, -4 }, // 0x46 'F'
{ 111, 5, 5, 7, 1, -4 }, // 0x47 'G'
{ 115, 5, 5, 7, 1, -4 }, // 0x48 'H'
{ 119, 5, 5, 7, 1, -4 }, // 0x49 'I'
{ 123, 5, 5, 7, 1, -4 }, // 0x4A 'J'
{ 127, 5, 5, 7, 1, -4 }, // 0x4B 'K'
{ 131, 5, 5, 7, 1, -4 }, // 0x4C 'L'
{ 135, 5, 5, 7, 1, -4 }, // 0x4D 'M'
{ 139, 5, 5, 7, 1, -4 }, // 0x4E 'N'
{ 143, 5, 5, 7, 1, -4 }, // 0x4F 'O'
{ 147, 5, 5, 7, 1, -4 }, // 0x50 'P'
{ 151, 5, 5, 7, 1, -4 }, // 0x51 'Q'
{ 155, 5, 5, 7, 1, -4 }, // 0x52 'R'
{ 159, 5, 5, 7, 1, -4 }, // 0x53 'S'
{ 163, 7, 5, 7, 0, -4 }, // 0x54 'T'
{ 168, 5, 5, 7, 1, -4 }, // 0x55 'U'
{ 172, 5, 5, 7, 1, -4 }, // 0x56 'V'
{ 176, 5, 5, 7, 1, -4 }, // 0x57 'W'
{ 180, 6, 5, 8, 1, -4 }, // 0x58 'X'
{ 184, 7, 5, 7, 0, -4 }, // 0x59 'Y'
{ 189, 5, 5, 7, 1, -4 }, // 0x5A 'Z'
{ 193, 3, 5, 7, 3, -4 }, // 0x5B '['
{ 195, 4, 4, 7, 1, -3 }, // 0x5C '\'
{ 197, 3, 5, 7, 1, -4 }, // 0x5D ']'
{ 199, 5, 6, 5, 0, -5 }, // 0x5E '^'
{ 203, 7, 1, 7, 0, 1 }, // 0x5F '_'
{ 204, 5, 6, 5, 0, -5 }, // 0x60 '`'
{ 208, 4, 4, 7, 1, -3 }, // 0x61 'a'
{ 210, 4, 5, 7, 2, -4 }, // 0x62 'b'
{ 213, 4, 4, 7, 2, -3 }, // 0x63 'c'
{ 215, 4, 5, 7, 1, -4 }, // 0x64 'd'
{ 218, 4, 4, 7, 1, -3 }, // 0x65 'e'
{ 220, 3, 5, 7, 3, -4 }, // 0x66 'f'
{ 222, 4, 5, 7, 1, -3 }, // 0x67 'g'
{ 225, 4, 5, 7, 1, -4 }, // 0x68 'h'
{ 228, 3, 5, 7, 2, -4 }, // 0x69 'i'
{ 230, 4, 6, 7, 1, -4 }, // 0x6A 'j'
{ 233, 4, 5, 7, 2, -4 }, // 0x6B 'k'
{ 236, 3, 5, 7, 3, -4 }, // 0x6C 'l'
{ 238, 5, 4, 8, 1, -3 }, // 0x6D 'm'
{ 241, 4, 4, 7, 1, -3 }, // 0x6E 'n'
{ 243, 4, 4, 7, 1, -3 }, // 0x6F 'o'
{ 245, 4, 5, 7, 1, -3 }, // 0x70 'p'
{ 248, 5, 5, 7, 1, -3 }, // 0x71 'q'
{ 252, 4, 4, 7, 2, -3 }, // 0x72 'r'
{ 254, 4, 4, 7, 1, -3 }, // 0x73 's'
{ 256, 4, 5, 7, 2, -4 }, // 0x74 't'
{ 259, 4, 4, 7, 1, -3 }, // 0x75 'u'
{ 261, 4, 4, 7, 1, -3 }, // 0x76 'v'
{ 263, 5, 4, 8, 1, -3 }, // 0x77 'w'
{ 266, 4, 4, 7, 1, -3 }, // 0x78 'x'
{ 268, 4, 5, 7, 1, -3 }, // 0x79 'y'
{ 271, 4, 4, 7, 1, -3 }, // 0x7A 'z'
{ 273, 5, 5, 7, 1, -4 }, // 0x7B '{'
{ 277, 1, 5, 7, 3, -4 }, // 0x7C '|'
{ 278, 5, 5, 7, 1, -4 }, // 0x7D '}'
{ 282, 3, 2, 7, 2, -4 } }; // 0x7E '~'
const GFXfont zx_spectrum3pt7b PROGMEM = {
(uint8_t *)zx_spectrum3pt7bBitmaps,
(GFXglyph *)zx_spectrum3pt7bGlyphs,
0x20, 0x7E, 7 };
// Approx. 955 bytes
//------------------------------
#define PIN 3
// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
// NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
// Position of the FIRST LED in the matrix; pick two, e.g.
// NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
// NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
// rows or in vertical columns, respectively; pick one or the other.
// NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
// in the same order, or alternate lines reverse direction; pick one.
// See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// Example for NeoPixel Shield. In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
#define mw 32
#define mh 8
#define NUMMATRIX (mw*mh)
CRGB matrixleds[NUMMATRIX];
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(matrixleds, mw, mh, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS );
const uint16_t colors[] = {
matrix->Color(255, 0, 0), matrix->Color(0, 255, 0), matrix->Color(0, 0, 255) };
void setup() {
FastLED.addLeds<NEOPIXEL,PIN>(matrixleds, NUMMATRIX);
matrix->begin();
matrix->setTextWrap(false);
matrix->setBrightness(40);
matrix->setTextColor(colors[0]);
//matrix->setFont(&Picopixel);
matrix->setFont(&zx_spectrum3pt7b);
//matrix->setFont(&Tiny3x3a2pt7b);
}
int x = mw;
int pass = 0;
String mensaje="HOLA CARACOLA 1234560 -->";
int lenText=(mensaje.length()*9); // para la fuente de 3x3 multiplicar cada caracter de la frase por 4
void loop() {
matrix->fillScreen(0); //borramos la pantalla
matrix->setCursor(x, 7); //posicionamos el curso
matrix->print((mensaje)); // el texto para mostrar
if(--x < -lenText) {
x = matrix->width(); //encajamos el texto en la matriz
if(++pass >= 3) pass = 0;
matrix->setTextColor(colors[pass]);
}
matrix->show(); //mostramos la matriz
delay(100);
}