//total runtime both key pressed+key not pressed
if(millis() >= (Runtime) )
{
Runtime = Runtime + 1000;
second = second +1;
if (second == 60)
{
second = 0;
minute = minute +1;
}
}
Time shows on lcd display well ,as second and minute
Its work well for total runtime
But i want ro measure total key pressed time
//
key= digitalRead(13);
if (key==1). //key pressed
{
if(millis()>=runtime1)
{
runtime1=Runtime- runtime2+1000;
sec=sec+1;
if (sec == 60)
{
sec = 0;
min = min +1;
}
}
}
if (key==0)//key not pressed
{
runtime2=millis();
}
This lower part of code not work
When i show both time on lcd i.e.total Runtime and key pressed time ,key pressed time goes faster than total Runtime