Please help me understand what does this piece of code does:
unsigned long nowtime = millis();
unsigned long update = 0;
if (nowtime > update)
update += 10000;
It lies in void loop part.
I understand it repeaditely calls pagenumber(), but how often? This update tries to catch nowtime? Why 10000?!
Every ten seconds, pagenumber is called, assuming the variables have global scope.
That code, as presented, will ALWAYS call pagenumber(), on EVERY iteration of loop(), because when the if is evaluated, nowtime will ALWAYS be > update!
And, even if update is global or static, it will NOT do the delay properly when update gets to within 10000 of its maximum value of 2^31.
If you want it to do otherwise, update needs to be either global or static, so it does NOT get zeroed on every iteration of loop().