Buenos días.
Funcionando un panel, con texto scrolling y bolas bailando (Las lineas de las bolas, las he comentado // para simplificar las primeras pruebas...Partiendo de ese codigo, se pueden hacer pruebas y modificaciones.
Mientras me llega el MEGA que he pedido, voy a intentar que pase la hora y fecha, scrolling en vez del texto añadiendo un reloj DS3231.
De momento, subo el código que uso, por si alguien quiere probar.
Yo uso un NANO o UNO con este mismo codigo. Para MEGA u otros, hay que modificar el código:
// Most of the signal pins are configurable, but the CLK pin has some
// special constraints. On 8-bit AVR boards it must be on PORTB...
// Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro),
// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be
// on the same PORT as the RGB data pins (D2-D7)...
// Pin 8 works on the Adafruit Metro M0 or Arduino Zero,
// Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB
// Matrix Shield, cut trace between CLK pads and run a wire to A4).
#include <RGBmatrixPanel.h>
#define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0)
//#define CLK 11 // USE THIS ON ARDUINO MEGA
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
// Last parameter = 'true' enables double-buffering, for flicker-free,
// buttery smooth animation. Note that NOTHING WILL SHOW ON THE DISPLAY
// until the first call to swapBuffers(). This is normal.
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, true);
// Double-buffered mode consumes nearly all the RAM available on the
// Arduino Uno -- only a handful of free bytes remain. Even the
// following string needs to go in PROGMEM:
// Similar to F(), but for PROGMEM string pointers rather than literals
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
const char str[] PROGMEM = "HOLA QUE TAL ?";
int16_t textX = matrix.width(),
textMin = sizeof(str) * -12,
hue = 0;
//int8_t ball[3][4] = {
// { 3, 0, 1, 1 }, // Initial X,Y pos & velocity for 3 bouncy balls
// { 17, 15, 1, -1 },
// { 27, 4, -1, 1 }
//};
static const uint16_t PROGMEM ballcolor[3] = {
0x0080, // Green=1
0x0002, // Blue=1
0x1000 // Red=1
};
void setup() {
matrix.begin();
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(2);
}
void loop() {
byte i;
// Clear background
matrix.fillScreen(0);
// Bounce three balls around
for(i=0; i<3; i++) {
// Draw 'ball'
// matrix.fillCircle(ball[i][0], ball[i][1], 5, pgm_read_word(&ballcolor[i]));
// Update X, Y position
// ball[i][0] += ball[i][2];
// ball[i][1] += ball[i][3];
// Bounce off edges
// if((ball[i][0] == 0) || (ball[i][0] == (matrix.width() - 1)))
// ball[i][2] *= -1;
// if((ball[i][1] == 0) || (ball[i][1] == (matrix.height() - 1)))
// ball[i][3] *= -1;
}
// Draw big scrolly text on top
matrix.setTextColor(matrix.ColorHSV(hue, 255, 255, true));
matrix.setCursor(textX, 1);
matrix.print(F2(str));
// Move text left (w/wrap), increase hue
if((--textX) < textMin) textX = matrix.width();
hue += 7;
if(hue >= 1536) hue -= 1536;
#if !defined(__AVR__)
// On non-AVR boards, delay slightly so screen updates aren't too quick.
delay(20);
#endif
// Update display
matrix.swapBuffers(false);
}
Saludos