EDIT:
const char *pc[NUM_ZONES] =
{
"ROOM", //0
"SUBJECT", //1
"GRADE",//2
};
I did this and I can't get them to display every row simultaneously.
void loop(void)
{
DateTime now = rtc.now();
char buffer[] = "hh:mm"; // hours and minutes
for (uint8_t i=0; i<NUM_ZONES; i++){
P.displayZoneText(0,now.toString(buffer), PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
P.displayZoneText(1, pc[1], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
P.displayZoneText(2, pc[2], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // display
P.displayZoneText(3, pc[3], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
}
}
I can only display one row at a time like this, now it only displays the hour:min.
Tell me what am I doing wrong
EDIT2:
Or like this:
-this is my goal, to change the text based on hour
void loop(void)
{
DateTime now = rtc.now();
char buffer[] = "hh:mm"; // hours and minutes
P.displayZoneText(0,now.toString(buffer), PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
if(now.hour()==21){
P.displayZoneText(1, pc[1], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
P.displayZoneText(2, pc[2], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // display
P.displayZoneText(3, pc[3], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
}
P.displayAnimate();
}
And at the moment with this code it only displays the hour and minutes
-
When you do it by hand like that, how do you figure how many spaces to put between the words? All you really need to do is to do that same thing in program, but it isn't clear exactly what that process is.Delta_G– Delta_G2020年05月08日 18:36:30 +00:00Commented May 8, 2020 at 18:36
1 Answer 1
I haven't used this library, but reading through the documentation it seems it operates on the concept of zones.
- Create a zone for each row (a zone is a contiguous block of modules forming a kind of sub-display)
- Perform operations on the zones with the zone-specific functions.
For example, setting up your zones would be:
P.begin(4); // We will have 4 zones
P.setZone(0, 0, 3); // Modules 0-3 in zone 0
P.setZone(1, 4, 7); // Modules 4-7 in zone 1
P.setZone(2, 8, 11); // Modules 8-11 in zone 2
P.setZone(3, 12, 15); // Modules 12-15 in zone 3
Then you can clear a zone with:
P.displayClear(2); // Clear zone 2
And write text to a zone with:
P.displayZoneText(3, "P03", PA_CENTER, 0, 0, PA_NO_EFFECT, PA_NO_EFFECT);
I'm not certain about what all the parameters mean, but the prototype is:
void displayZoneText(uint8_t z, const char *pText, textPosition_t align, uint16_t speed, uint16_t pause, textEffect_t effectIn, textEffect_t effectOut = PA_NO_EFFECT);
-
I managed to do that. I created my 4 zones and I can now display text on any of them. Now, I would like to know how to display hour:minutes from the clock module and text simultaneously. Hour and minutes on one row and text on the other 3Rehoboam– Rehoboam2020年05月15日 18:03:18 +00:00Commented May 15, 2020 at 18:03
-
You print the time in zone 0 and the other text in the other zones.Majenko– Majenko2020年05月15日 18:08:52 +00:00Commented May 15, 2020 at 18:08
-
Yes, but I don't know the prototype of that. I can't print them. Only separatelyRehoboam– Rehoboam2020年05月15日 18:11:19 +00:00Commented May 15, 2020 at 18:11
-
1I give you an explicit example in my answer.Majenko– Majenko2020年05月15日 18:13:04 +00:00Commented May 15, 2020 at 18:13
-
Explore related questions
See similar questions with these tags.