i am sorry but i am not a programmer guy i am much like interested in this things....
So what you mean to say is
include this thing
boolean electricity_state = 0;
void loop() {
electricity_status = digitalRead(5);
if (electricity_status == 0){ //if electricity goes
//electricity gone inform via sms - also Do something when electricity goes
sms(1); // the one is to inform exactly electricity changed status IT MUST DO THIS JUST ONE TIME UNTILL STATUS CHANGE
digitalWrite(6, LOW);
electricity_state = 1; // do you mean this
}
}
void sms() {
//read the variable value and act according to it..
//send sms to my number
//set time how to do that ? if suppose the electricity FLIP within 30 sec than ?
}