I suggest you just hold hours, minutes and seconds in separate integer variables and use snprintf() to format them to a string when you want to print them.
I also suggest you don't use delay to control the speed of your sketch. Check the value of millis() and when it shows that 1000 milliseconds have elapsed, increment your second counter:
unsigned long lastTime = 0;
const unsigned long ONE_SECOND = 1000;
...
if(millis() - lastTime >= ONE_SECOND)
{
// one second has elapsed
handleElapsedSecond();
lastTime += ONE_SECOND;
}
Here, handleElapsedSecond() would contain whatever logic you need to calculate the new time and update the display etc.
#include <displayClient.h>
long old_ticks,ticks;
char old_time[8];
int k = 900;
byte second=0,second2=0,minute=0,minute2=0,hour=0,hour2=0;
void setup(){
Serial.begin(9600);
fillScreen(1);
setTextSize(4);
}
as requested this is the missing part of the code..
PeterH thanks for your suggestion, I'll try that code out. I still would like to understand why this code doesn't work.. it's unsettling since it looks logically consistent..
I have already posted the entire code.. my previous post had the missing data declarations and setup(). thanks for the remark on the >7 that somehow slipped by unnoticed..
so far i've discovered that if i remove the char array problem goes away, but i need to put those numbers in a string/char array.. what can i do to fix this?
this is driving me crazy.. i can't figure it out.. my char array doesn't store any of the values i'm assigning to it, why is that? if i Serial.print the byte var second,min,hour,..etc it prints if i add those as elements of the array and print the array nothing prints!
only the freaking : print not to mention that if i do Serial.print(time); nothing at all prints
and this is if i print the numbers not as elments of the array..