Thanx to some other friendlies on this forum, i've managed to use a for loop to display LED-pixels on a Matrix in sync with an RTC-clock.
Both for loops work excellent, i've tested them seperatly.
But the problem starts when the two for loops are both introduced. Then the code causes the display to go completely wonky
I think i've got an infinityloop problem, but my code skills are seriously lacking.
I believe i need to introduce a break or some other form of reset in both loops, to keep them both functioning at the same time.
How would I code that?
if (Display_Mode == 3) //This displaymode will display a figure build up from specific LED-pixels - each one representing a specific second or minute.
{
Display_Mode_Next = 1;
byte Sec=1;
byte Pix_Sec= now.second();
byte secondRow[] = {16,17,18,18,19,19,20,21,21,22,22,23,24,24,25,25,24,24,23,22,22,21,21,20,19,19,18,18,17,16,15,14,13,13,12,12,11,10,10,9,9,8,7,7,6,6,7,7,8,9,9,10,10,11,12,12,13,13,14,15};
byte secondColumn[] = {1,1,1,2,2,3,3,3,4,4,5,5,5,6,7,8,9,10,10,10,11,11,12,12,12,13,13,14,14,14,14,14,14,13,13,12,12,12,11,11,10,10,10,9,8,7,6,5,5,5,4,4,3,3,3,2,2,1,1,1};
byte Min=1;
byte Pix_Min= now.minute();
byte minuteRow[] = {16,17,16,17,18,19,20,19,20,21,22,23,22,23,24,24,23,22,23,22,21,20,19,20,19,18,17,16,17,16,15,14,15,14,13,12,11,12,11,10,9,8,9,8,7,7,8,9,8,9,10,11,12,11,12,13,14,15,14,15};
byte minuteColumn[] = {2,2,3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,8,9,9,10,10,10,11,11,12,12,12,13,13,13,13,12,12,12,11,11,10,10,10,9,9,8,8,8,7,7,7,6,6,5,5,5,4,4,3,3,3,2,2,};
matrix.setCursor(0, 0); // start at top left, with one pixel of spacing
for (Sec=0; Sec<now.second()+1; Sec++)
{
matrix.drawPixel(secondRow[Sec], secondColumn[Sec], matrix.Color333(2, 0, 0));
}
for (Min=0; Min<now.minute()+1; Min++)
{
matrix.drawPixel(secondRow[Min], secondColumn[Min], matrix.Color333(2, 0, 0));
}
delay(999);
}
}