Hi Blue Eyes,
If you are still around ...
Thanks very much for helping with my programming issue for use of the MD_MAX72xx. I was able to get the code working well.
I have a more minor issue I has hoping you might be able to help me with. Others can certainly cime in as well.
Following is my code:
#include <DS3231.h> // added to use the real time clock
//Following is for use of MAX72 display **********
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 8
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
// HARDWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
//************************************************
// Change Daily Activities below ***************
const char * const mon_msg[] = {"Monday", "Monday text A", "Monday text B", "Monday text C"};
const char * const tues_msg[] = {"Tuesday", "Tuesday text A", "Tuesday text B", "Tuesday text C"};
const char * const wed_msg[] = {"Wednesday", "Wednesday text A", "Wednesday text B", "Wednesday text C"};
const char * const thur_msg[] = {"Thursday", "Thursday text A", "Thursday text B", "Thursday text C"};
const char * const fri_msg[] = {"Friday", "Friday text A", "Friday text B", "Friday text C"};
const char * const sat_msg[] = {"Saturday", "Saturday text A", "Saturday text B", "Saturday text C"};
const char * const sun_msg[] = {"Sunday", "Sunday text A", "Sunday text B", "Sunday text C"};
const char * const error_msg[] = {"DOW error!", "DOW error!", "DOW error!", "DOW error!"};
//**********************************************
const char **msgs;
int n = 0;
DS3231 rtc(SDA, SCL); //This initiates the DS3231 using the hardware interface // added to use RTC
Time t; // added to use RTC
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// *** I added the next 6 lines in order to initiate the real time clock in the DS3231 device. ****
// Initialize the rtc object
rtc.begin();
// The following lines can be uncommented to set the date and time
// rtc.setDOW(WEDNESDAY); // Set Day-of-Week MONDAY, TUESDAY, etc.
// rtc.setTime(19, 47, 30); // Set the time to 12:00:00 (24hr format)
// rtc.setDate(15, 05, 2019); // Set date: (dd,mm,yyyy)
//******************
// initialize the MAX72 LED display ***
P.begin();
P.setZoneEffect(0, true, PA_FLIP_LR);
}
void loop() {
if (!strcmp((rtc.getDOWStr()) , "Monday")) {
msgs = mon_msg;}
else if (!strcmp((rtc.getDOWStr()), "Tuesday")) {
msgs = tues_msg;}
else if (!strcmp((rtc.getDOWStr()), "Wednesday")){
msgs = wed_msg;}
else if (!strcmp((rtc.getDOWStr()), "Thursday")) {
msgs = thur_msg;}
else if (!strcmp((rtc.getDOWStr()), "Friday")) {
msgs = fri_msg;}
else if (!strcmp((rtc.getDOWStr()), "Saturday")) {
msgs = sat_msg;}
else if (!strcmp((rtc.getDOWStr()), "Sunday")) {
msgs = sun_msg;}
else {
msgs = error_msg;}
//**** Will comment this stuff out for now. If needed later we can activate. ***
////Following is day of the week/date and time information from Real Time Clock (DS3231)
//t = rtc.getTime(); // get time from RTC
//// Print Day-of-Week
//Serial.println(rtc.getDOWStr());
//// Print Date
//Serial.println(rtc.getDateStr(FORMAT_SHORT, FORMAT_MIDDLEENDIAN, '/'));
//// Print time
//Serial.print(t.hour);
//Serial.print(":");
//Serial.print(t.min);
//Serial.print(":");
//Serial.println(t.sec);
//**************************
Serial.println(msgs[0]);
Serial.println(msgs[1]);
Serial.println(msgs[2]);
Serial.println(msgs[3]);
delay(3000);
//Added this to use MAX72xx display ***
P.displayAnimate();
// set up the string
if (n < 4) {
P.displayText(msgs[n], PA_CENTER,0,0, PA_PRINT, PA_NO_EFFECT);
n = n+1; }
if (n == 4) {
n = 0; }
delay(5000);
}
Here is the issue -
When I am using the Serial monitor and the last 9 lines of code above are commented out, here is what the output on the Serial monitor looks like. (It looks like it should.)
Thursday
Thursday text A
Thursday text B
Thursday text C
Thursday
Thursday text A
Thursday text B
Thursday text C
Thursday
Thursday text A
Thursday text B
Thursday text C
When I include the last 9 lines of code, here is what the output looks like.
Thursday
Thursday text A
Thursday text B
Thursday text C
7777777777777777Thursday
Thursday text A
Thursday text B
Thursday text C
7777777777777777777777777777Thursday
Thursday text A
Thursday text B
Thursday text C
7777777777777777777777777777Thursday
For some reason, these 7s start creeping in to. Do you know what is happening?
Thank you,
Scott