#include <RTClib.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
RTC_DS3231 rtc;
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 5
#define CLK_PIN 52
#define DATA_PIN 51
#define CS_PIN 53
int hour;
int minute;
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
void setup(void)
{
Serial.begin(9600);
//P.begin();
// SETUP RTC MODULE
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort;
}
myDisplay.begin();
}
void loop(void)
{
DateTime now = rtc.now();
//time = " ";
hour = now.hour();
minute = now.minute();
String text = String(hour) + ":" + String(minute);
char time[8];
text.toCharArray(time,6);
if (myDisplay.displayAnimate()) {
myDisplay.displayText(time,PA_CENTER, 100, 10, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
}