Closed 8266er closed 5 months ago
The code
P.print(( currentTime.Hour) && ( currentTime.Minute));
Is not corrrect. In C++ && operator is a boolean operator. You are using this operator correctly in your if statements at the end of the loop() function.
MD_Parola requires you to pass through a c-string for it to display and the c-string must remain in scope for the duration of the animation. You are creating a c-string in str above these lines to display debug on the serial monitor - you should initially try and display this c-string to the matrix to confirm that your code is correct.
In order to display with scrolling you cannot use .print(). You will need to restructure the code to allow the animation to take place (no delay() and a free running loop() function). The Parola_Zone_TimeMsg example is close to what you need to do - just ignore the zone related stuff and focus on how the loop() code is structured to display different messages in sequence.
Hello Marco.
Thanks for the tips!
I have now changed the example (Parola_Zone_Mesg) and use DS1307 with your library. I have reduced the sketch to the display of the time. But the time of the RTC is not displayed. Only 00:00 is displayed according to "Font_Data.h".
Now I don't know what to do.
Best regards
Paul
The Code
// Program to demonstrate the MD_Parola library
//
// Display the time in one zone and other information scrolling through in
// another zone.
// - Time is shown in a user defined fixed width font
// - Scrolling text uses the default font
// - Temperature display uses user defined characters
// - Optional use of DS1307 module for time and DHT11 sensor for temp and humidity
// - DS1307 library (MD_DS1307) found at https://github.com/MajicDesigns/DS1307
// - DHT11 library (DHT11_lib) found at http://arduino.cc/playground/Main/DHT11Lib
// - MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//
// Use the DS1307 clock module
#define USE_DS1307 1 // 0
// Header file includes
#include <DFRobotDFPlayerMini.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <MD_DS1307.h>
#include <Wire.h>
#include <SPI.h>
#include "Font_Data.h"
// Hardware deffinition MAX7219
#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4
// for NODE MCU
#define CLK_PIN 14 // D5
#define DATA_PIN 13 // D7
#define CS_PIN 15 // D8
// CONNECTIONS DS1307:
// DS3231 SDA --> SDA
// DS3231 SCL --> SCL
// DS3231 VCC --> 3.3v or 5v
// DS3231 GND --> GND
#define myRTC RTC ///< Library created instance of the RTC class
// DF Player Mini
SoftwareSerial mySerial1(1, 3);
//NodeMCU TX (GPIO1) an DF Player mini RX, NodeMCU RX (GPIO3) an DF Player mini TX
DFRobotDFPlayerMini myDFPlayer; // DF Player definieren
/*
Verzeichnis auf SD Karte muss „MP3“ heissen!
Dieses Verzeichnis muss exakt als „MP3“ benannt werden.
HBis zu 3000 Dateien mit dem Namensschema 0001.mp3 (bzw. wav), 0002.mp3, ….. 3000.mp3.
Alle Dateien sind direkt ansprechbar und keine Probleme mit der Reihenfolge.
*/
void myDFPlayerSetup() {
myDFPlayer.setTimeOut(500);
myDFPlayer.volume(18); //Lauttstärke Auswahl 0 bis 30
myDFPlayer.EQ(DFPLAYER_EQ_BASS);
myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
//myDFPlayer.randomAll();
// myDFPlayer.play(loop);
// myDFPlayer.play();
}
// Hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
// MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
int brightness = 20;
#define SPEED_TIME 75
#define PAUSE_TIME 0
#define MAX_MESG 20
// Turn on debug statements to the serial output
#define DEBUG 0
// Global variables
char szTime[9]; // mm:ss\0
char szMesg[MAX_MESG + 1] = "";
char *mon2str(uint8_t mon, char *psz, uint8_t len)
// Get a label from PROGMEM into a char array
{
static const char str[][4] PROGMEM =
{
"Jan", "Feb", "Mar", "Apr", "Mai", "Jun",
"Jul", "Aug", "Sep", "Okt", "Nov", "Dez"
};
*psz = '\0';
mon--;
if (mon < 12)
{
strncpy_P(psz, str[mon], len);
psz[len] = '\0';
}
return (psz);
}
char *dow2str(uint8_t code, char *psz, uint8_t len)
{
static const char str[][10] PROGMEM =
{
"So", "Mo", "Di", "Mi",
"Do", "Fr", "Sa"
};
*psz = '\0';
code--;
if (code < 7)
{
strncpy_P(psz, str[code], len);
psz[len] = '\0';
}
return (psz);
}
void getTime(char *psz, bool f = true)
// Code for reading clock time
{
// USE_DS1307
RTC.readTime();
sprintf(psz, "%02d%c%02d", RTC.h, (f ? ':' : ' '), RTC.m);
}
void getDate(char *psz)
// Code for reading clock date
{
// USE_DS1307
char szBuf[10];
RTC.readTime();
sprintf(psz, "%d %s %04d", RTC.dd, mon2str(RTC.mm, szBuf, sizeof(szBuf) - 1), RTC.yyyy);
}
void setup(void)
{
Serial.begin(115200);
mySerial1.begin(9600);
P.begin();
// P.begin(2);
// P.setZone(0, 0, MAX_DEVICES - 5);
// P.setZone(1, MAX_DEVICES - 4, MAX_DEVICES - 1);
P.setFont(numeric7Seg);
// P.setFont(1, numeric7Seg);
P.setInvert(false);
// P.displayZoneText(1, szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
P.displayText(szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
// P.displayZoneText(0, szMesg, PA_CENTER, SPEED_TIME, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
// P.displayText(szMesg, PA_CENTER, SPEED_TIME, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
//#if USE_DS1307
RTC.control(DS1307_CLOCK_HALT, DS1307_OFF);
RTC.control(DS1307_12H, DS1307_OFF);
//#endif
getTime(szTime);
}
void loop(void)
{
static uint32_t lastTime = 0; // millis() memory
static uint8_t display = 0; // current display mode
static bool flasher = false; // seconds passing flasher
P.displayAnimate();
/*
if (P.getZoneStatus(0))
{
switch (display)
{
case 0: // day of week
P.setTextEffect(0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
display++;
*/
//#if USE_DS1307
dow2str(RTC.dow, szMesg, MAX_MESG);
P.displayReset(0);
// Finally, adjust the time string if we have to
if (millis() - lastTime >= 1000)
{
lastTime = millis();
getTime(szTime, flasher);
flasher = !flasher;
P.displayReset(1);
}
//+++
if (( RTC.h == 6 ) && ( RTC.m == 35 )) { // 6:35 Uhr Wecken
myDFPlayer.play(25);
}
if (( RTC.h == 23 ) && ( RTC.m == 0 )) { // 23 Uhr
myDFPlayer.play(24);
}
else if (( RTC.h == 22 ) && ( RTC.m == 0 )) { // 22 Uhr
myDFPlayer.play(23);
}
else if (( RTC.h == 21 ) && ( RTC.m == 0 )) { // 21 Uhr
myDFPlayer.play(22);
}
else if (( RTC.h == 20 ) && ( RTC.m == 0 )) { // 20 Uhr
myDFPlayer.play(21);
}
else if (( RTC.h == 19 ) && ( RTC.m == 0 )) { // 19 Uhr
myDFPlayer.play(20);
}
else if (( RTC.h == 18 ) && ( RTC.m == 0 )) { // 18 Uhr
myDFPlayer.play(19);
}
else if (( RTC.h == 17 ) && ( RTC.m == 0 )) { // 17 Uhr
myDFPlayer.play(18);
}
else if (( RTC.h == 16 ) && ( RTC.m == 0 )) { // 16 Uhr
myDFPlayer.play(17);
}
else if (( RTC.h == 15 ) && ( RTC.m == 0 )) { // 15 Uhr
myDFPlayer.play(16);
}
else if (( RTC.h == 14 ) && ( RTC.m == 0 )) { // 14 Uhr
myDFPlayer.play(15);
}
else if (( RTC.h == 13 ) && ( RTC.m == 0 )) { // 13 Uhr
myDFPlayer.play(14);
}
else if (( RTC.h == 12 ) && ( RTC.m == 0 )) { // 12 Uhr
myDFPlayer.play(13);
}
else if (( RTC.h == 11 ) && ( RTC.m == 0 )) { // 11 Uhr
myDFPlayer.play(0012);
}
else if (( RTC.h == 10 ) && ( RTC.m == 0 )) { // 10 Uhr
myDFPlayer.play(11);
}
else if (( RTC.h == 9 ) && ( RTC.m == 0 )) { // 09 Uhr
myDFPlayer.play(10);
}
else if (( RTC.h == 8 ) && ( RTC.m == 0 )) { // 08 Uhr
myDFPlayer.play(9);
}
else if (( RTC.h == 7 ) && ( RTC.m == 0 )) { // 07 Uhr
myDFPlayer.play(8);
}
else if (( RTC.h == 6 ) && ( RTC.m == 0 )) { // 06 Uhr
myDFPlayer.play(7);
}
else if (( RTC.h == 5 ) && ( RTC.m == 0 )) { // 05 Uhr
myDFPlayer.play(6);
}
else if (( RTC.h == 4 ) && ( RTC.m == 0 )) { // 04 Uhr
myDFPlayer.play(5);
}
else if (( RTC.h == 3 ) && ( RTC.m == 0 )) { // 03 Uhr
myDFPlayer.play(4);
}
else if (( RTC.h == 2 ) && ( RTC.m == 0 )) { // 02 Uhr
myDFPlayer.play(3);
}
else if (( RTC.h == 1 ) && ( RTC.m == 0 )) { // 02 Uhr
myDFPlayer.play(2);
}
else if (( RTC.h == 0 ) && ( RTC.m == 0 )) { // 00 Uhr
myDFPlayer.play(1);
}
//+++
}
You have not eliminated the code that references zones completely. The below should display the time, updated each second. If you are still getting 00:00 then you may have comms issues to the clock module. ` void loop(void) { ... P.displayAnimate();
// Finally, adjust the time string if we have to
if (millis() - lastTime >= 1000)
{
lastTime = millis();
getTime(szTime, flasher);
flasher = !flasher;
P.displayReset();
}
... } `
Hello Marco.
Thank you very much for your renewed help!!!
Now the time is displayed correctly, but when a full hour is reached and the MP3 file is called up, the clock stops at the hour.
I have no idea how to solve this.
I would be very happy if you could help me ONE LAST TIME ;-)
Best regards
Paul
//Vorlage MD_Parola_Zone_TimeMsg
// Use the DS1307 clock module
#define USE_DS1307 1 // 0
// Header file includes
#include <DFRobotDFPlayerMini.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <MD_DS1307.h>
#include <Wire.h>
#include <SPI.h>
#include "Font_Data.h"
// Hardware deffinition MAX7219
#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4
// for NODE MCU
#define CLK_PIN 14 // D5
#define DATA_PIN 13 // D7
#define CS_PIN 15 // D8
// CONNECTIONS DS1307:
// DS3231 SDA --> SDA
// DS3231 SCL --> SCL
// DS3231 VCC --> 3.3v or 5v
// DS3231 GND --> GND
#define myRTC RTC ///< Library created instance of the RTC class
// DF Player Mini
//SoftwareSerial mySerial1(1, 3);
SoftwareSerial mySerial1(3, 1);
//NodeMCU TX (GPIO1) an DF Player mini RX, NodeMCU RX (GPIO3) an DF Player mini TX
DFRobotDFPlayerMini myDFPlayer; // DF Player definieren
/*
Verzeichnis auf SD Karte muss „MP3“ heissen!
Dieses Verzeichnis muss exakt als „MP3“ benannt werden.
HBis zu 3000 Dateien mit dem Namensschema 0001.mp3 (bzw. wav), 0002.mp3, ….. 3000.mp3.
Alle Dateien sind direkt ansprechbar und keine Probleme mit der Reihenfolge.
*/
void myDFPlayerSetup() {
myDFPlayer.setTimeOut(500);
myDFPlayer.volume(18); //Lauttstärke Auswahl 0 bis 30
myDFPlayer.EQ(DFPLAYER_EQ_BASS);
myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
}
// Hardware SPI connection
// MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
int brightness = 20;
#define SPEED_TIME 75
#define PAUSE_TIME 100
//#define PAUSE_TIME 0
#define MAX_MESG 20
// Turn on debug statements to the serial output
#define DEBUG 0
// Global variables
char szTime[9]; // mm:ss\0
char szMesg[MAX_MESG + 1] = "";
char *mon2str(uint8_t mon, char *psz, uint8_t len)
// Get a label from PROGMEM into a char array
{
static const char str[][4] PROGMEM =
{
"Jan", "Feb", "Mar", "Apr", "Mai", "Jun",
"Jul", "Aug", "Sep", "Okt", "Nov", "Dez"
};
*psz = '\0';
mon--;
if (mon < 12)
{
strncpy_P(psz, str[mon], len);
psz[len] = '\0';
}
return (psz);
}
char *dow2str(uint8_t code, char *psz, uint8_t len)
{
static const char str[][10] PROGMEM =
{
"So", "Mo", "Di", "Mi",
"Do", "Fr", "Sa"
};
*psz = '\0';
code--;
if (code < 7)
{
strncpy_P(psz, str[code], len);
psz[len] = '\0';
}
return (psz);
}
void getTime(char *psz, bool f = true)
// Code for reading clock time
{
// USE_DS1307
RTC.readTime();
sprintf(psz, "%02d%c%02d", RTC.h, (f ? ':' : ' '), RTC.m);
}
void getDate(char *psz)
// Code for reading clock date
{
// USE_DS1307
char szBuf[10];
RTC.readTime();
sprintf(psz, "%d %s %04d", RTC.dd, mon2str(RTC.mm, szBuf, sizeof(szBuf) - 1), RTC.yyyy);
}
void setup(void)
{
Serial.begin(115200);
mySerial1.begin(9600);
P.begin();
P.setFont(numeric7Seg);
P.setInvert(false);
P.displayText(szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
//#if USE_DS1307
RTC.control(DS1307_CLOCK_HALT, DS1307_OFF);
RTC.control(DS1307_12H, DS1307_OFF);
//#endif
getTime(szTime);
}
void loop(void)
{
static uint32_t lastTime = 0; // millis() memory
static uint8_t display = 0; // current display mode
static bool flasher = false; // seconds passing flasher
P.displayAnimate();
//#if USE_DS1307
dow2str(RTC.dow, szMesg, MAX_MESG);
// Finally, adjust the time string if we have to
if (millis() - lastTime >= 1000)
{
lastTime = millis();
getTime(szTime, flasher);
flasher = !flasher;
P.displayReset(0);
}
// /* //+++
if (( RTC.h == 6 ) && ( RTC.m == 35 )) { // 6:35 Uhr Wecken
myDFPlayer.play(25);
}
if (( RTC.h == 23 ) && ( RTC.m == 0 )) { // 23 Uhr
myDFPlayer.play(24);
}
else if (( RTC.h == 22 ) && ( RTC.m == 0 )) { // 22 Uhr
myDFPlayer.play(23);
}
else if (( RTC.h == 21 ) && ( RTC.m == 0 )) { // 21 Uhr
myDFPlayer.play(22);
}
else if (( RTC.h == 20 ) && ( RTC.m == 0 )) { // 20 Uhr
myDFPlayer.play(21);
}
else if (( RTC.h == 19 ) && ( RTC.m == 0 )) { // 19 Uhr
myDFPlayer.play(20);
}
else if (( RTC.h == 18 ) && ( RTC.m == 0 )) { // 18 Uhr
myDFPlayer.play(19);
}
else if (( RTC.h == 17 ) && ( RTC.m == 0 )) { // 17 Uhr
myDFPlayer.play(18);
}
else if (( RTC.h == 16 ) && ( RTC.m == 0 )) { // 16 Uhr
myDFPlayer.play(17);
}
else if (( RTC.h == 15 ) && ( RTC.m == 0 )) { // 15 Uhr
myDFPlayer.play(16);
}
else if (( RTC.h == 14 ) && ( RTC.m == 0 )) { // 14 Uhr
myDFPlayer.play(15);
}
else if (( RTC.h == 13 ) && ( RTC.m == 0 )) { // 13 Uhr
myDFPlayer.play(14);
}
else if (( RTC.h == 12 ) && ( RTC.m == 0 )) { // 12 Uhr
myDFPlayer.play(13);
}
else if (( RTC.h == 11 ) && ( RTC.m == 0 )) { // 11 Uhr
myDFPlayer.play(12);
}
else if (( RTC.h == 10 ) && ( RTC.m == 0 )) { // 10 Uhr
myDFPlayer.play(11);
}
else if (( RTC.h == 9 ) && ( RTC.m == 0 )) { // 09 Uhr
myDFPlayer.play(10);
}
else if (( RTC.h == 8 ) && ( RTC.m == 0 )) { // 08 Uhr
myDFPlayer.play(9);
}
else if (( RTC.h == 7 ) && ( RTC.m == 0 )) { // 07 Uhr
myDFPlayer.play(8);
}
else if (( RTC.h == 6 ) && ( RTC.m == 0 )) { // 06 Uhr
myDFPlayer.play(7);
}
else if (( RTC.h == 5 ) && ( RTC.m == 0 )) { // 05 Uhr
myDFPlayer.play(6);
}
else if (( RTC.h == 4 ) && ( RTC.m == 0 )) { // 04 Uhr
myDFPlayer.play(5);
}
else if (( RTC.h == 3 ) && ( RTC.m == 0 )) { // 03 Uhr
myDFPlayer.play(4);
}
else if (( RTC.h == 2 ) && ( RTC.m == 0 )) { // 02 Uhr
myDFPlayer.play(3);
}
else if (( RTC.h == 1 ) && ( RTC.m == 0 )) { // 02 Uhr
myDFPlayer.play(2);
}
else if (( RTC.h == 0 ) && ( RTC.m == 0 )) { // 00 Uhr
myDFPlayer.play(1);
}
//+++ */
}
Does the clock restart when the tune stops playing? Does the tune play at all?
It seems to me that your logic should be that the minutes and the seconds should be == 0 to play the tune otherwise the tune play request will be sent the whole time that minutes == 0 (which is check many times per second).
Comment out the code block (all the if statements) that play your tunes. Does the clock still stop? If the clock does not stop then the calls to mtDFPlayer.play() are the problem.
I would move the check to play the tune only when the clock is updated because the second has passed. There is no need to check at other times. I would also point out that you can simplify your code a lot if you make sure that tune number N is played at hour number N (or N+1, or some other direct relationship):
if (millis() - lastTime >= 1000)
{
lastTime += 1000;
getTime(szTime, flasher);
flasher = !flasher;
P.displayReset();
if (RTC.h == 6 && RTC.m == 35 && RTC.s == 0) // 6:35:00 Uhr Wecken
myDFPlayer.play(25);
else if (RTC.m == 0 && RTC.s == 0)
myDFPlayer.play(RTC.h+1);
}
Hello Marco.
Würdest Du mir dabei auch unter die Arme greifen?
Thanks for your help and patience ;-)
So far it has been running smoothly.
But now I am looking for a solution,
the time information == 19, == 5, == 0 in line 174 (alarm time) as variables via Bluetooth Serial send, without every time upload a new alarm time via IDE.
Would you also help me with this?
Best regards
Paul
//Vorlage MD_Parola_Zone_TimeMsg
// Use the DS1307 clock module
#define USE_DS1307 1 // 0
// Header file includes
#include <DFRobotDFPlayerMini.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <MD_DS1307.h>
#include <Wire.h>
#include <SPI.h>
//#include "Font_Data.h"
// Hardware deffinition MAX7219
#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
//#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4
// for NODE MCU
#define CLK_PIN 14 // D5
#define DATA_PIN 13 // D7
#define CS_PIN 15 // D8
// CONNECTIONS DS1307:
// DS3231 SDA --> SDA
// DS3231 SCL --> SCL
// DS3231 VCC --> 3.3v or 5v
// DS3231 GND --> GND
#define myRTC RTC ///< Library created instance of the RTC class
// DF Player Mini
// D4 ist RX - ESP8266 zu TX - DFPlayer
// D6 ist TX - ESP8266 über 1 kOhm Rvor zu RX - DFPlayer
//SoftwareSerial mySerial(D6, D4);
SoftwareSerial mySerial1(D4, D6);
DFRobotDFPlayerMini myDFPlayer; // DF Player definieren
/*
Verzeichnis auf SD Karte muss „MP3“ benannt werden!
Bis zu 3000 Dateien mit Namensschema 0001.mp3 (bzw. wav), 0002.mp3, ….. 3000.mp3 möglich.
Alle Dateien sind direkt ansprechbar und keine Probleme mit der Reihenfolge.
*/
// Hardware SPI connection
// MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
int brightness = 20;
#define SPEED_TIME 75
#define PAUSE_TIME 100
//#define PAUSE_TIME 0
#define MAX_MESG 20
// Turn on debug statements to the serial output
#define DEBUG 0
// Global variables
char szTime[9]; // mm:ss\0
char szMesg[MAX_MESG + 1] = "";
char *mon2str(uint8_t mon, char *psz, uint8_t len)
// Get a label from PROGMEM into a char array
{
static const char str[][4] PROGMEM =
{
"Jan", "Feb", "Mar", "Apr", "Mai", "Jun",
"Jul", "Aug", "Sep", "Okt", "Nov", "Dez"
};
*psz = '\0';
mon--;
if (mon < 12)
{
strncpy_P(psz, str[mon], len);
psz[len] = '\0';
}
return (psz);
}
char *dow2str(uint8_t code, char *psz, uint8_t len)
{
static const char str[][10] PROGMEM =
{
"So", "Mo", "Di", "Mi",
"Do", "Fr", "Sa"
};
*psz = '\0';
code--;
if (code < 7)
{
strncpy_P(psz, str[code], len);
psz[len] = '\0';
}
return (psz);
}
void getTime(char *psz, bool f = true)
// Code for reading clock time
{
// USE_DS1307
RTC.readTime();
sprintf(psz, "%02d%c%02d", RTC.h, (f ? ':' : ' '), RTC.m);
}
void getDate(char *psz)
// Code for reading clock date
{
// USE_DS1307
char szBuf[10];
RTC.readTime();
sprintf(psz, "%d %s %04d", RTC.dd, mon2str(RTC.mm, szBuf, sizeof(szBuf) - 1), RTC.yyyy);
}
void myDFPlayerSetup()
{
myDFPlayer.setTimeOut(500);
myDFPlayer.volume(18); //Lauttstärke Auswahl 0 bis 30
myDFPlayer.EQ(DFPLAYER_EQ_BASS);
myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
}
void setup(void)
{
Serial.begin(115200);
mySerial1.begin(9600);
//Use softwareSerial to communicate with MP3
myDFPlayer.begin(mySerial1);
P.begin();
// P.setFont(numeric7Seg);
P.setInvert(false);
P.displayText(szTime, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
//#if USE_DS1307
RTC.control(DS1307_CLOCK_HALT, DS1307_OFF);
RTC.control(DS1307_12H, DS1307_OFF);
//#endif
getTime(szTime);
}
void loop(void)
{
static uint32_t lastTime = 0; // millis() memory
static uint8_t display = 0; // current display mode
static bool flasher = false; // seconds passing flasher
P.displayAnimate();
//#if USE_DS1307
dow2str(RTC.dow, szMesg, MAX_MESG);
// Finally, adjust the time string if we have to
if (millis() - lastTime >= 1000)
{
lastTime += 1000;
getTime(szTime, flasher);
flasher = !flasher;
P.displayReset();
if ( RTC.h == 19 && RTC.m == 5 && RTC.s == 0) // 19:05:00 Uhr Wecken
myDFPlayer.play(25);
//+++
if ( RTC.h == 23 && RTC.m == 0 && RTC.s == 0) // 23 Uhr
myDFPlayer.play(24);
if ( RTC.h == 22 && RTC.m == 0 && RTC.s == 0) // 22 Uhr
myDFPlayer.play(23);
if ( RTC.h == 21 && RTC.m == 0 && RTC.s == 0) // 21 Uhr
myDFPlayer.play(22);
if ( RTC.h == 20 && RTC.m == 0 && RTC.s == 0) // 20 Uhr
myDFPlayer.play(21);
if ( RTC.h == 19 && RTC.m == 0 && RTC.s == 0) // 19 Uhr
myDFPlayer.play(20);
if ( RTC.h == 18 && RTC.m == 0 && RTC.s == 0) // 18 Uhr
myDFPlayer.play(19);
if ( RTC.h == 17 && RTC.m == 0 && RTC.s == 0) // 17 Uhr
myDFPlayer.play(18);
if ( RTC.h == 16 && RTC.m == 0 && RTC.s == 0) // 16 Uhr
myDFPlayer.play(17);
if ( RTC.h == 15 && RTC.m == 0 && RTC.s == 0) // 15 Uhr
myDFPlayer.play(16);
if ( RTC.h == 14 && RTC.m == 0 && RTC.s == 0) // 14 Uhr
myDFPlayer.play(15);
if ( RTC.h == 13 && RTC.m == 0 && RTC.s == 0) // 13 Uhr
myDFPlayer.play(14);
if ( RTC.h == 12 && RTC.m == 0 && RTC.s == 0) // 12 Uhr
myDFPlayer.play(13);
if ( RTC.h == 11 && RTC.m == 0 && RTC.s == 0) // 11 Uhr
myDFPlayer.play(12);
if ( RTC.h == 10 && RTC.m == 0 && RTC.s == 0) // 10 Uhr
myDFPlayer.play(11);
if ( RTC.h == 9 && RTC.m == 0 && RTC.s == 0) // 09 Uhr
myDFPlayer.play(10);
if ( RTC.h == 8 && RTC.m == 0 && RTC.s == 0) // 08 Uhr
myDFPlayer.play(9);
if ( RTC.h == 7 && RTC.m == 0 && RTC.s == 0) // 07 Uhr
myDFPlayer.play(8);
if ( RTC.h == 6 && RTC.m == 0 && RTC.s == 0) // 06 Uhr
myDFPlayer.play(7);
if ( RTC.h == 5 && RTC.m == 0 && RTC.s == 0) // 05 Uhr
myDFPlayer.play(6);
if ( RTC.h == 4 && RTC.m == 0 && RTC.s == 0) // 04 Uhr
myDFPlayer.play(5);
if ( RTC.h == 3 && RTC.m == 0 && RTC.s == 0) // 03 Uhr
myDFPlayer.play(4);
if ( RTC.h == 2 && RTC.m == 0 && RTC.s == 0) // 02 Uhr
myDFPlayer.play(3);
if ( RTC.h == 1 && RTC.m == 0 && RTC.s == 0) // 01 Uhr
myDFPlayer.play(2);
if ( RTC.h == 0 && RTC.m == 0 && RTC.s == 0) // 00 Uhr
myDFPlayer.play(1);
//+++
}
}
Good to know that things are now working more smoothly.
I think this additional functionality is beyond just helping you with the functions of the MD_Parola library. There are many examples on the internet for doing this Bluetooth comms and there is also MD_Parola examples that use Bluetooth to set the display message, so you can look at that. Also, there is the Arduino forum that has many people willing to help for this kind of general problem.
Can i use this library for P10 LED Display Panel Module - 32x16 ?
Please do not hijack threads for unrelated issues, especially when the original issue is already closed. In future please open a new enquiry.
I don't know what a P10 matrix is. The library will only work with LEDs controlled by the MAX7219 or MAX 7221 IC.
IMPORTANT
Before submitting this issue [ ] Have you tried using the latest version of the library? [ ] Have you checked this has not already been submitted and/or resolved? [ ] If you are requesting help a better choice may be the Arduino forum
Hello Marco. Thanks for your reply.
I want to display time, date and year (RtcDS3231.h) with scroll effect (MD_Parola.h, MAX72xx.h) on a 32×8 MAX7219 matrix with a NodeMCU8266.
Everything is displayed correctly in the serial monitor of the Arduino IDE.
But time, date and year are not displayed on the Max7219 matrix ;-(
What am I doing wrong (line 128 to 144)????
I would be very happy if you could take a look at the skecht and help me with these lines.
Here the code:
Describe your issue here.
Your Environment
I am using MD_Parola V 3.7.2, MD_MAX72xx V 3.5.2. Arduino IDE version:1.8.13 Host OS and Version: Ubuntu Linux 22.04 CPU Hardware model/type: 4x Intel cor i3-5005U 2.00GHz
Code Demonstrating the Issue
Best regards
Paul
Max7219_RTC_MP3Clock.zip