I am trying to make an SMS notification for my backup generator, Basically when my generator comes on because of lost of power it should send me an SMS message. Currently I have the following code working with a push button however I am trying to make it message me when the pin goes hi and when it goes low but only one time each.
<void loop()
{
if(digitalRead(genonpin)==HIGH)
{
Serial.println("button pressed");
delay(20000);
SendOnMessage();
}>
Because this is a loop if the pin stays hi it will send me messages over and over which is not what I want. Anyone has a better approach for such project?
Thanks in advance!