gsm shield to text a float count total then reset counter

Hi all

I have a Arduino Uno & Tinysine GSM shield. I have a push button counter with a float variable incrimenting this (then converted into a string). At the moment it texts me the float count each time it is pushed, which is great, but.......

Now I want it to only text me the float value when there has been no activity for 5mins and then reset the counter!

Any pointers would be greatly appreciated! thanks a lot

void loop()
{
char txtMsg[200];
buttonState = digitalRead(buttonPin); // read the pushbutton input pin:
if (buttonState != lastButtonState) // compare the buttonState to its previous state
{
if (buttonState == HIGH) // if the state has changed, increment the counter, if the current state is high then the circuit is open
{
myval += 0.5;
Serial.print("value: ");
Serial.print (myval);
dtostrf(myval, 4, 2, str);
sprintf(value,"%smm value", str);
if(sms.SendSMS("+.............", value))
{;}
else
{
delay(1000);//1 second inbetween switches
}
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
}
}

Now I want it to only text me the float value when there has been no activity for 5mins and then reset the counter!

So, what is the problem?

Specifically, what does "No activity for 5 mins" mean? No state changes on buttonPin? If so, you'll need to record WHEN each state change happens. Then, periodically (aka on every pass through loop()), you check to see if the time now minus the time of the last event of interest exceeds some threshold. If so, do whatever needs doing.