//components using voltage divide crkt,gsm sim 900a,arduino
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10);
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
// read the value from the sensor:
sensorValue = analogRead(sensorPin*57.5);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for milliseconds:
delay(sensorValue);
if(sensorValue>230)
Serial.write(mySerial.read());
}
void SendMessage()
{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS="+91xxxxxxxxxx"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("over voltage detected");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}