marco_c:
Time stamp should already be an array of characters or sprintf() and print() will not work.
Atlast I managed to scroll the time. Thanks for the guidance.
But after every scroll_left of time, the date flashes and again scrolling of time continues.
#include <Wire.h>
#include <MD_DS1307.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <RTClib.h>
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define MAX_DEVICES 4
#define PAUSE_TIME 3000
#define SCROLL_SPEED 30
RTC_DS1307 rtc;
//MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);
void setup ()
{
Wire.begin();
Serial.begin(57600);
P.begin();
if(! rtc.begin())
{
Serial.println("Couldn't find RTC");
while (1);
}
if(! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop ()
{
DateTime now = rtc.now();
char timeStamp[15];
char dateStamp[15];
sprintf(timeStamp, "%d:%d", now.hour() ,now.minute());
Serial.println(timeStamp);
sprintf(dateStamp, "%d/%d", now.day(),now.month());
Serial.println(dateStamp);
for (uint8_t i=0; i<ARRAY_SIZE(timeStamp); i++)
{
P.displayText(timeStamp, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_SCROLL_LEFT);
while (!P.displayAnimate())
;
break;
}
P.print(dateStamp);
}
The looping continues with flashing date after every scroll_left.
I am planning to scroll the date after the timeloop finishes.