Flame Sensor With GSM and Arduino
Flame Sensor With GSM and Arduino
h>
#include <SoftwareSerial.h> //Create software serial object to communicate with
SIM800L
SoftwareSerial GSM(8, 9); //SIM800L Tx & Rx is connected to Arduino #8 & #9
char phone_no[]="+923378655465"; //change +92 with country code and 3378655465 with
phone number to sms
Serial.println("Initializing....");
initModule("AT","OK",1000); //Once the handshake test is successful,
it will back to OK
initModule("ATE1","OK",1000); //this command is used for enabling echo
initModule("AT+CPIN?","READY",1000); //this command is used to check whether
SIM card is inserted in GSM Module or not
initModule("AT+CMGF=1","OK",1000); //Configuring TEXT mode
initModule("AT+CNMI=2,2,0,0,0","OK",1000); //Decides how newly arrived SMS messages
should be handled
Serial.println("Initialized Successfully");
sms_Status = EEPROM.read(1);
call_Status = EEPROM.read(2);
}
void loop(){
readSMS();
if (var_1 == 1){
if (!(strncmp(input_string, "Sms On", 6))){sms_Status=1;
EEPROM.write(1, sms_Status);
sendSMS(phone_no,"Message is Active");
}
else if (!(strncmp(input_string, "Sms Off", 7))){sms_Status=0;
EEPROM.write(1, sms_Status);
sendSMS(phone_no,"Message is Deactivate");
}
var_1 = 0;
var_2 = 0;
}