arduino - ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cp -


iam using itead sim908 gsm/gps/gprs module arduino uno, iam trying send gps coordinates sms message , gprs internet server, cant run both same time, although it's work separately.

when try send gps coordinates via sms message , send data via gprs server same time have error :

error: sim900 doesn't answer. check power , serial pins in gsm.cpp

this code, 1 have solution ?

#include "sim900.h" #include  #include "inetgsm.h" #include "sms.h" //#include "call.h" #include "gps.h" char smsbuffer2[150]; char id[]="12"; char httpbuffer[160];  inetgsm inet; //callgsm call; smsgsm sms; gpsgsm gps; char msg[50]; int numdata; char lon[15]; char lat[15]; char alt[15]; char time[20]; char vel[15]; char msg1[5]; char msg2[5]; char mobile[]="0595285486"; char stat; char inserial[50]; int i=0; boolean started=false; void setup(){ get_gps(); delay(1000); send_server(); delay(1000); send_sms(); } void loop(){ } void get_gps(){ serial.begin(9600); serial.println("gsm shield testing."); //start configuration of shield baudrate. //for http uses raccomanded use 4800 or slower.   if (gsm.begin(9600)) {       serial.println("\nstatus=ready");       started=true;        gsm.forceon();  } else serial.println("\nstatus=idle");   if(started) {       //gps attach       if (gps.attachgps())             serial.println("status=gpsready");       else serial.println("status=error");       delay(20000); //time fixing       stat=gps.getstat();       if(stat==1)            serial.println("not fixed");       else if(stat==0)            serial.println("gps off");       else if(stat==2)            serial.println("2d fixed");       else if(stat==3)            serial.println("3d fixed");       delay(5000);       //get data gps       gps.getpar(lon,lat,alt,time,vel);       serial.println(lon);       serial.println(lat);       serial.println(alt);       serial.println(time);       serial.println(vel);       convert2degrees(lat);       convert2degrees(lon);  } } void send_server(){ if (gsm.begin(9600)) { serial.println("\nstatus=ready"); started=true; } else serial.println("\nstatus=idle");      if(started) {        //gprs attach, put in order apn, username , password.       //if no needed auth let them blank.       if (inet.attachgprs("internet", "", ""))            serial.println("status=attached");       else serial.println("status=error");       delay(1000);       //read ip address.       gsm.simplewriteln("at+cifsr");       delay(5000);       //read until serial buffer empty.       gsm.whilesimpleread();       //tcp client get, send request server ,       //save reply.       /*               httpbuffer[0]='\0'; strcat(httpbuffer,"/getdata.aspx?lat="); strcat(httpbuffer,lat);  strcat(httpbuffer,"&&lon="); strcat(httpbuffer,lon); strcat(httpbuffer,"&&id"); strcat(httpbuffer,id);          serial.println(httpbuffer); */ numdata=inet.httppost("qou.azurewebsites.net", 80,"httpbuffer", msg, msg,12); //print results. serial.println("\nnumber of data received:"); serial.println(numdata); serial.println("\ndata received:"); serial.println(msg); } } void send_sms(){   if (gsm.begin(9600)) {       serial.println("\nstatus=ready");       started=true;  } else serial.println("\nstatus=idle"); if(started){              smsbuffer2[0]='\0'; strcat(smsbuffer2,"vehicle accident occurs vehicle have "); strcat(smsbuffer2,"id number"); strcat(smsbuffer2,id); strcat(smsbuffer2,"in location :"); strcat(smsbuffer2,lat); strcat(smsbuffer2,lon); strcat(smsbuffer2,"owner name:ayman abd albasit sadq daqah");  strcat(smsbuffer2,"mobile :"); strcat(smsbuffer2,mobile); if (sms.sendsms(mobile, "smsbuffer2")) serial.println("\nsms sent ok"); } } 


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -