Hello Guys I just want to ask what I can I do because my gsm sim808 doesn't receive messages after pressing the pushbutton and sending it 6 keywords it doesn't reply and receive anymore my code is in below thankyou for your answers guys I really need it badly for my project thankyouuu
#include <SoftwareSerial.h>
SoftwareSerial sim808(11, 10); //Arduino(RX), Arduino(TX)
//Arduino(RX) to SIM808(TX)
//Arduino(TX) to SIM808(RX)
char phone_no[] = "+639513927267";// replace this with your phone no.
char phone_no2[] = "+639953492721";// replace this with your phone no2.
char phone_no3[] = "+639672534320";// replace this with your phone no3.
char phone_no4[] = "+639104033684";// replace this with your phone no4.
char phone_no5[] = "+639366198755";// replace this with your phone no5.
String data[7];
#define DEBUG true
String state,timegps,latitude,longitude,atmsg,msgi,gspeed;
bool bAdmin,bGetloc,bHelp,bClrmsg,bClrst=0;
int buttonpin = 12;
void setup() {
pinMode (buttonpin,INPUT);
sim808.begin(9600);
Serial.begin(9600);
delay(100);
sim808.print("AT+CMGF=1\r");//configure SIM to TEXT mode
delay(500);
sendData("AT+CGNSPWR=1",1000,DEBUG);//Turn on GPS(GNSS - Global Navigation Satellite System)
delay(500);
sendData("AT+CGNSSEQ=RMC",1000,DEBUG);
delay(500);
sendData("AT+CGPSSTATUS?",1000,DEBUG);//this will check your GPS status. A working GPS should get either a 2D or 3D fix location
delay(500);
sendMessage("Your bike GPS has been switched ON please wait for it to blink every second.");
Serial.println ("Done Notifying");
delay (500);
}
void loop() {
if (Serial.available()>0){sim808.write(Serial.read());}
if (sim808.available()>0){Serial.write(sim808.read());}
atmsg = sim808.readString();
if(atmsg.indexOf("+CMTI: ") >=0) {
Serial.println("Message received: \r" + atmsg); delay (3000);
msgi = atmsg.substring(atmsg.indexOf(",")+1);
sendData("AT+CMGR="+msgi,1000,DEBUG); Serial.println ("Done senda");
delay (1000);
// delay(50);
}
if (bAdmin ==1 && bHelp ==1){delay (1000);sendMessage("What can I do for you?\n1. Get Location\n2. Clear Messages\n3. Help");Serial.print ("Done Sending Keywords");bAdmin = 0; bHelp =0;}
if (bAdmin ==1 && bGetloc ==1){delay (1000); getGPSLocation();bAdmin = 0; bGetloc =0; }
if (bAdmin ==1 && bClrmsg ==1){ delay (1000); clearMessages();bAdmin = 0; bClrmsg =0; }
if (bAdmin ==1 && bClrst ==1){ delay (1000); setup(); Serial.println ("Done Sending Reset");bAdmin = 0; bClrst =0; }
Buttonpressing ();
}
void clearMessages(){
sendTabData("AT+CMGD=1,4",1000,DEBUG); Serial.println ("Done Clearing");
delay(3000);
sendMessage("Messages cleared!");
}
void getGPSLocation(){
sendTabData("AT+CGNSINF",1000,DEBUG);//Get GPS info(location
Serial.println("State :"+state);
Serial.println("Time :"+timegps);
Serial.println("Latitude :"+latitude);
Serial.println("Longitude :"+longitude);
sim808.print("AT+CMGS="");
sim808.print(phone_no);
sim808.println(""");
sim808.print("\nVehicle speed: ");
sim808.print (gspeed);
sim808.print(" kph\n\n");
sim808.println("Open the map link below for the GPS location... ");
sim808.print("Google Maps");
sim808.print(latitude);
sim808.print(",");
sim808.print (longitude);
delay(500);
sim808.println((char)26); // End AT command with a ^Z, ASCII code 26
sim808.println();
sim808.flush();
Serial.println ("Done Sending Loc");
}
void gpsEmergency (){ sendTabData("AT+CGNSINF",1000,DEBUG);
Serial.println("State :"+state);
Serial.println("Time :"+timegps);
Serial.println("Latitude :"+latitude);
Serial.println("Longitude :"+longitude);
sim808.print("AT+CMGS="");
sim808.print(phone_no);
sim808.println(""");
sim808.println("HELLO THIS IS RAYMARK DURO I AM ON A EMERGENCY RIGHT NOW PLEASE DO CONTACT ME AT MY NUMBER 09513927267 AND I AM LOCATED AT : ");
sim808.print("Google Maps");
sim808.print(latitude);
sim808.print(",");
sim808.print (longitude);
delay(500);
sim808.println((char)26); // End AT command with a ^Z, ASCII code 26
sim808.println();
sim808.flush();
Serial.println ("done 1");
delay (10000);
}
void gpsEmergency2 (){
sim808.print ("AT+CGNSINF");
sim808.print ("\n");
Serial.println("State :"+state);
Serial.println("Time :"+timegps);
Serial.println("Latitude :"+latitude);
Serial.println("Longitude :"+longitude);
sim808.print("AT+CMGS="");
sim808.print(phone_no2);
sim808.println(""");
sim808.println("HELLO THIS IS RAYMARK DURO I AM ON A EMERGENCY RIGHT NOW PLEASE DO CONTACT ME AT MY NUMBER 09513927267 AND I AM LOCATED AT : ");
sim808.print("Google Maps");
sim808.print(latitude);
sim808.print(",");
sim808.print (longitude);
delay(500);
sim808.println((char)26); // End AT command with a ^Z, ASCII code 26
sim808.println();
sim808.flush();
Serial.println ("done 2");
delay (10000);
}