LED DOT MATRIX WITH Real TIME CLOCK MODULE DS1302

DEAR ARDUINO EXPERTS… :slight_smile:

I’m having problem with LED dot matrix as i can only put strings in the characters, but not numbers for example dates, values…
can somebody help?. Here is the code… I already comment where the problem is

// based on an orginal sketch by Arduino forum member "danigom"
// http://forum.arduino.cc/index.php?action=profile;u=188950

#include <avr/pgmspace.h>
#include <LedControl.h>
#include <stdio.h>
#include <string.h>
#include <DS1302.h>  //http://www.henningkarlsen.com/electronics/download.php?f=DS1302.rar

const int numDevices = 1;      // number of MAX7219s used
const long scrollDelay = 100;   // adjust scrolling speed
uint8_t CE_PIN   = 5;
uint8_t IO_PIN   = 6;
uint8_t SCLK_PIN = 7;
const int PINMOTION=9;
char buf[50];
char day[10];
DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);
unsigned long bufferLong [14] = {0}; 
int da

LedControl lc=LedControl(12,11,10,numDevices);
// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219
void printyear(){
Time t = rtc.time();
snprintf(buf, sizeof(buf), "%04d",t.yr);
Serial.println(buf);
}
void printmonth(){
Time t = rtc.time();
snprintf(buf, sizeof(buf), "%02d",t.mon);
Serial.print(buf);
}
void printdate(){
Time t = rtc.time();
snprintf(buf, sizeof(buf), "%02d",t.date);
Serial.print(buf);
}
prog_uchar scrollText1[] PROGMEM ={snprintf(buf, sizeof(buf), "%02d",date)  };
//  !!!!----HEREIS THE PROB

void setup(){
  Serial.begin(9600);
  pinMode(PINMOTION,INPUT);
    for (int x=0; x<numDevices; x++){
        lc.shutdown(x,false);       //The MAX72XX is in power-saving mode on startup
        lc.setIntensity(x,8);       // Set the brightness to default value
        lc.clearDisplay(x);         // and clear the display
    }
}

void loop(){ 
  delay(1000);
  if(digitalRead(PINMOTION)==HIGH){
    
  }
    //scrollFont();
}

Your problem is that the string to be scrolled is being placed in READ ONLY (FLASH) memory. That only works for string constants: strings that never change. If you want the values to change you have to put the string in regular RAM:

uchar scrollText1[15];

 snprintf(scrollText, sizeof(scrollText), "%02d",date);

This might not work if the "LedControl" library only works with FLASH. Check the library documentation and examples.