Max72xxPanel question.

Hi everyone!
I'm working on a retirement gift for a coworker that will count down the days till she's outta there, and I'm having a small issue. I've got the basic 4 panel led board from amazon and am running it with the max72panel library and my issue is this: I clearly don't know enough about what's happening in the code to place a stationary bitmap on the led panels. I know the answer lies somewhere in that for loop, but I've spent a few hours tinkering with it and can't seem to work it out. Any help with where exactly I should look would be very much appreciated. I've scoured the forums and found a few questions about this, but no solutions. For now, I've just thrown in a pot to control the speed. Fun, but not what I'm looking for.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;

int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf http://arduino.cc/en/Reference/SPI )
int numberOfHorizontalDisplays = 8;
int numberOfVerticalDisplays = 1;

Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);



int spacer = 1;
int width = 5 + spacer; // The font width is 5 pixels

void setup() {
  Serial.begin(9600);
  Wire.begin();
  RTC.begin();
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  matrix.setIntensity(7); // Use a value between 0 and 15 for brightness
  RTC.adjust(DateTime(__DATE__, __TIME__));
 
  matrix.setRotation(0, 1);
  matrix.setRotation(1, 1);
  matrix.setRotation(2, 1);
  matrix.setRotation(3, 1);
}

void loop() {
  /*if (Serial.available() > 0) {
    int tape = Serial.read();
    }*/
  DateTime now = RTC.now();
  int Time = (now.second());
 
  char day[2];
  String Day;
  Day = String(Time - 60);
  
  String tape = ("");
  //int wait = 20;


  for ( int i = 0 ; i < width * tape.length() + matrix.width() - 1 - spacer; i++ ) {
    int wait = analogRead(A0);
    wait = map(wait, 0, 1023, 1, 500);
     Serial.println(wait);
    matrix.fillScreen(LOW);

    int letter = i / width;
    int x = (matrix.width() - 1) - i % width;
    int y = (matrix.height() - 8) / 2; // center the text vertically

    while ( x + width - spacer >= 0 && letter >= 0 ) {
      if ( letter < tape.length() ) {
        matrix.drawChar(x, y, tape[letter], HIGH, LOW, 1);
      }

      letter--;
      x -= width;
    }

    matrix.write(); // Send bitmap to display

    delay(wait);
  }
}

That code looks like something for a scrolling message display, which now doesn't work. I can't make any sense of the date/time stuff.

Are you wanting to show a static message or a scrolling one?

What exactly do you want to show ?

Yours,
TonyWilk

Hi. Thanks for the reply.
The current code does display the date, though the version I've posted has the ticket printing nothing. The message is represented as the String tape.
It does scroll, which is fine, but I'd like it to remain stationary. That's my issue. How do I get it to display in the center of the LED panel and stay. I was able to slow down the ticking considerably by adjusting the delay(wait) time with a potentiometer, but that isn't really what I'm looking for.

Thanks for any help!

Ifmatrix.drawChar(x, y, tape[letter], HIGH, LOW, 1); prints a single character at location x,y

Then simply...

String tape = ("ABC");

y=0;  // top of character at top of display

// loop for each character in 'tape'
for( i=0; i < tape.length(); i++ )
{
    x= i * width;  // step horizontal by width of character and spacer

    matrix.drawChar(x, y, tape[ i ], HIGH, LOW, 1);   // draw a character from 'tape'
}
matrix.write(); // Send bitmap to display

... should write all characters from 'tape' on the display

Yours,
TonyWilk

Worked like a charm!
Thank you so much.
-Sean