hello..am trying to build a program for controlling sim800 module.Now I stuck at a problem.. what my need is the sim800 will receive incoming message from different numbers.it should check all the numbers and if there is a particular message from a a particular number then only an output sensor is active and replying back to that particular number about the sensor status..
I tried various programs with my limited knowledge..sometimes it is working..but most of the time it is not reading the incoming messages continusly..please help .sorry for my english
this is my program
String sms,aa,bb,cc;
long int dd=+918606****35;
void setup()
{
Serial.begin(9600);
Serial.println("AT");
Serial.println("AT+CMGF=1\r");
delay(2000);
aa=("AT+CSMP=17,167,0,0\r");
Serial.println(aa); //if both are true sending msg
delay(2000);
}
void loop()
{
while (Serial.available()>0) //checking for serial inputs
{sms=Serial.readString();
Serial.println(sms);
delay(2000);
if(sms.indexOf("on")>=0 && (sms.indexOf("+9185")>=0)) //checking both sms content and senders number with the predefined content
{
bb=("AT+CMGS="+9185"\r");
Serial.println(bb) ;
delay(2000);
Serial.write("device is on");
delay(2000);
Serial.println((char)26);
delay(1000);
}
delay(1000);
sms="";
}
}
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.