I has put my number 6011234567 so that my GSM can make call / message to this number, but I did not get any calls and messages from GSM, but in serial monital it say , it has call and send message to my number, btw i has use two different of my sim but still don’t solve my problem, is this due to a problem with my sim? sorry for my bad english
String ph1="6011234567"; //Enter your phone number to call #01
String ph2="6011234567"; //Enter your phone number to call #02
int vibrationPin = 2;
bool flag=false;
void setup() {
Serial.begin(9600);
Serial.print("AT+CMGF=1\r\n"); //Text SMS mode in GSM
pinMode(vibrationPin,INPUT);
digitalWrite(vibrationPin,LOW);
//System Calibration
for(int i=0;i<10;i++)
{
delay(200);
}
}
void loop(){
int a=vibration();
if(a>15000){
flag=true;
}
if (flag) {
message1(); //Generate the Alert Message First Mobile
delay(1000);
message2(); //Generate the Alert Message Second Mobile
delay(1000); //1 minute delay
call1(); //Call to First mobile
delay(1000);
call2();
delay(1000); //call to Second mobile
}
flag=false;
}
void message1() //Method to send message #01
{
Serial.print("AT+CMGS=\"");
Serial.print(ph1);
Serial.print("\"\r\n");
delay(2000);
Serial.print("---ALERT---\n Call Police , Any try to Unlock Door");
Serial.write(0x1A);
}
void message2() //Method to send message #02
{
Serial.print("AT+CMGS=\"");
Serial.print(ph2);
Serial.print("\"\r\n");
delay(2000);
Serial.print("---ALERT---\n Call Police , Any One Try to Unlock Door ");
Serial.write(0x1A);
}
void call1() //Method to get call #01
// Dhaddammm Roboyics //
{
Serial.print("ATD");
Serial.print(ph1);
Serial.print(";\r\n");
delay(10000);
Serial.println("ATH");
}
void call2() //Method to get call #02
{
Serial.print("ATD");
Serial.print(ph2);
Serial.print(";\r\n");
delay (10000);
Serial.println("ATH");
}
int vibration(){
delay(10);
int vibrationDetection=pulseIn(vibrationPin,HIGH); //wait for the pin to get HIGH and returns measurement
return vibrationDetection;
}