Prevent multiple alert unless state changes

Hi, I'm Derrick and I'm currently working on a sms flood alarm system using float switch sensors. I have an issue where, in any state Arduino keeps sending multiple alerts even while in the same state. I would appreciate if anyone can guide me on how to make the system send a single notification for each state?

My code are as follows :

#include<SoftwareSerial.h>
SoftwareSerial SIM900A (10,11); //10 Rx 11 Tx

int LED = 9;
int sensor = 12;
int val = 0; //reads 1 or 0

void setup (){

pinMode (sensor, INPUT);
pinMode (LED, OUTPUT);

Serial.begin (9600);
SIM900A.begin(9600);

}

void loop() {

Serial.println("System begin");
val = digitalRead(sensor);

//high=water low

if (val==HIGH ){

digitalWrite (LED, LOW);
delay (50);
SMS2();
Serial.println("Value High, Water Low");
val=00;

}

else {

digitalWrite (LED,HIGH);
delay (300);
digitalWrite(LED, LOW);
delay(50);
SMS1=1;
Serial.println("Value Low, Water High");
val=00;

}

}

void SMS1(){

Serial.println("AT+CMGF=1");
delay(1000);
SIM900A.println("AT+CMGS="+60176269507"\r");
delay(1000);
SIM900A.println("Water Detected");
delay(1000);
SIM900A.println((char)26);
Serial.println("Alert Sent");

}

void SMS2()
{
Serial.println("AT+CMGF=1");
delay(1000);
SIM900A.println("AT+CMGS="+60176269507"\r");
delay(1000);
SIM900A.println("Water Not Detected");
delay(1000);
SIM900A.println((char)26);
Serial.println("Alert Sent");

}

Take a look at the state change example in the IDE.

Please remember to use code tags when posting code

Keep track of the previous state, compare to current state, if different raise the alarm. Basic state tracking.