#include < SoftwareSerial.h >
SoftwareSerial gsmSerial(10, 11); // RX, TX
#define WATER_SENSOR_PIN 2 // the pin where water sensor is connected
String phoneNumber = "+1234567890"; // Change this to your phone number
void setup() {
pinMode(WATER_SENSOR_PIN, INPUT);
gsmSerial.begin(9600); // Setting the baud rate of GSM Module delay(100); sendMessage("System Started.");
}
void loop() {
int waterSensorState = digitalRead(WATER_SENSOR_PIN);
if (waterSensorState == LOW) {
// If the sensor output is LOW, the water level is low (Or sensor is not in contact with water)
sendMessage("Warning: No water detected! Please refill the tank.");
delay(20000); // Wait for 20 seconds before next check to avoid constant messages
}
}