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;
}
}