Greetings to all Forensic experts.
Excuse me; perhaps I didn't put the topic in the correct category. I would appreciate some help from my friends.
I have an Arduino sketch for a clock with a P5 RGB 64x32 Matrix using an ESP32.
The original link is on this page: https://github.com/NeoCat/ESP32-P3RGB64x32MatrixPanel And the practical example is here: https://www.youtube.com/watch?v=Pu28vPFUX0w
I made all the connections of the LED Matrix to the ESP32 correctly, as described on the author's page, but there might be a bug? I don't know. I'm posting a practical video of what happens when I turn it on.
Video of my Matrix here: https://youtu.be/JlJaNmZPtLg
And the code is this:
#include <WiFi.h>
#include <Adafruit_GFX.h>
#include <P3RGB64x32MatrixPanel.h>
#include <Fonts/FreeSansBold9pt7b.h>
// constructor with default pin wiring
P3RGB64x32MatrixPanel matrix;
// use this constructor for custom pin wiring instead of the default above
// these pins are an example, you may modify this according to your needs
//P3RGB64x32MatrixPanel matrix(25, 26, 27, 21, 22, 23, 15, 32, 33, 12, 16, 17, 18);
char ssid[] = "Xxxxxxx";
char pass[] = "Xxxxxxxxxxxx";
#define TZ (-3*60*60) /*JST*/
void setup() {
Serial.begin(115200);
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid); // print the network name (SSID);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(1000);
}
Serial.println("");
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
configTime(TZ, 0, "ntp.nict.jp", "ntp.jst.mfeed.ad.jp"); // enable NTP
matrix.begin(); // setup the LED matrix
}
void loop()
{
if (WiFi.status() != WL_CONNECTED)
ESP.restart();
time_t t;
static time_t last_t;
struct tm *tm;
static const char* const wd[7] = {"Dom","Seg","Ter","Qua","Qui","Sex","Sab"};
t = time(NULL);
if (last_t == t) return; // draw each second
last_t = t;
tm = localtime(&t);
matrix.fillScreen(0);
matrix.setTextColor(matrix.color444(15, 15, 15));
matrix.setFont(&FreeSansBold9pt7b);
matrix.setCursor(0, 13);
matrix.printf("%02d:%02d", tm->tm_hour, tm->tm_min);
matrix.setFont();
matrix.printf(":%02d", tm->tm_sec);
matrix.setCursor(2, 16);
matrix.setTextColor(tm->tm_wday == 0 ? matrix.color444(15, 0, 0) :
tm->tm_wday == 6 ? matrix.color444(0, 6, 15) :
matrix.color444(6, 15, 6));
matrix.printf("%s", wd[tm->tm_wday]);
matrix.setCursor(2, 24);
matrix.setTextColor(matrix.color444(12, 12, 4));
matrix.printf("%04d/%02d/%02d\n", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
matrix.swapBuffer(); // display the image written to the buffer
}
I moved your topic to an appropriate forum category @Dancopy.
In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Hi Pert
Yes, I did look and scroll through the categories, but I couldn't find a suitable one. I must have skimmed over it and missed it. Actually, I messed up.
I'd like to know where you moved my topic. Thank you.
Well, since it is all taking place during the timing of code in loop(), I think you might comment out one of the above lines and see what changes. That is called debugging.
As a test, I would put a delay after this to determine if the display itself is being blanked, instead of a buffer. Your first video link shows no blanking between updates of the display, while the second video appears to be blanking the entire display then displaying the new text.
Paul_KD7HB
Commenting out the line "matrix.fillScreen(0);" makes the screen light up only in red pixels, without flickering, but it doesn't count the time, that is, the seconds don't blink.
And commenting out the line "matrix.setTextColor(matrix.color444(15, 15, 15));" does nothing.
After the line "matrix.fillScreen(0);" I added: "delay (100);" but nothing changed.
But what I find strange is that I took the code exactly from the original library mentioned above, at the beginning of the topic, in ESP32-P3RGB64x32MatrixPanel Examples > NTPClock.
Do you have the exact display that was used by whoever wrote the library, or a slightly different version?
Have you tried compiling the code with an older version of the ESP32 board package? Version 3.0 made some significant changes that caused problems with some older code.
I would not think 2.0.11 would cause a problem, the changes in 3.0 and later was what I was speculating might cause a problem. That is a fairly old library, it may not work at all with the latest version of the board package.
Which particular variant of the ESP32 are you using? There may be a conflict with one of the pins you are using to drive the display.
Can you tell if the display is blanking immediately after updating the image, or does the display blank during the update process?
Surely you noticed that the library used is the P3 RGB 64x32 Matrix Panel 192x96mm, and my panel is a P5 RGB 64x32 Matrix Panel 320x160mm, but surely that doesn't matter, does it?
david_2018
First of all, thank you for giving me your attention. Regarding your questions, I think this answer is satisfactory for you. Inside the "Examples" folder of this same library, there is a file "testshapes_32x64.ino", which I tested, and it is working correctly.
At the bottom of the library page, in README.md, it says:
"Note that this library heavily uses the timer interrupt to drive the LED matrix to enable software-based 5-bit PWM for each line. This may conflict with WiFi setup, so you should start WiFi before matrix.begin(), which sets up timer interrupts."