I have try ,
but I think that this is not for the SIM808 breakboard
becaue when I get a replay , I get it directly from the modem
maybe I miisng something ?
this is what I have now (without tinygps \ NeoGPS) :
#include<stdio.h>
#include<string.h>
#define DEBUG false
int POWER_KEY = 9;
bool SIM808_ON = false;
String answer = "";
int answer_size = 0;
String CIPSEND = "";
void setup()
{
pinMode(POWER_KEY, OUTPUT);
//********Turn on SIM808 when power up*********
digitalWrite(POWER_KEY, HIGH);
delay(1000);
digitalWrite(POWER_KEY, LOW);
SerialUSB.begin(115200);
delay(2000);
// while (!SerialUSB) {
// delay(50); // wait for Arduino Serial Monitor to connect the port
// }
SerialUSB.println("Start to run! V1 ");
Serial1.begin(115200);
//********check open************
sendData("AT", 1000, DEBUG);
delay(1000);
//******************************
//********if SIM808 off, turn on it*********
if (!SIM808_ON)
{
digitalWrite(POWER_KEY, LOW);
delay(3000);
digitalWrite(POWER_KEY, HIGH);
SerialUSB.println("Turn on SIM808");
delay(10000);
}
//GPS test
sendData("AT+CGNSPWR=1", 1000, DEBUG);//GNSS POWER CONTROL ON
delay(1000);
sendData("AT+CGNSSEQ=\"RMC\"", 1000, DEBUG);//
delay(1000);
//GSM/GPRS test
sendData("AT+CCID", 1000, DEBUG);//get SIM number
delay(1000);
sendData("AT+CSTT=internet", 1000, DEBUG);// Setup APN
delay(1000);
sendData("AT+CGATT=1", 1000, DEBUG);// connected to the GPRS network
delay(1000);
sendData("AT+CIICR", 1000, DEBUG);// connected to the GPRS network
delay(1000);
sendData("AT+CIFSR", 1000, DEBUG);// Show IP address
delay(1000);
sendData("AT+CIPSTART=UDP,1.2.3.4,5678", 1000, DEBUG);//
delay(1000);
sendData("AT+CIPSEND=3", 1000, DEBUG);//
delay(1000);
sendData("ON!\n\r", 1000, DEBUG);
delay(1000);
sendData("AT+CIPCLOSE", 1000, DEBUG);//
delay(1000);
answer = sendData("AT+CGNSINF", 1000, DEBUG);//
delay(1000);
SerialUSB.println(answer);
}
the startup is working
I can see it get a IP , and show me the GPS location
but how do I use tinygps \ NeoGPS?
what do I need to change \ save in another way ?
I have try may ways - all of them didn't pass the compiler
I have try to run even sometime more easy\simple
and run substing according to the start of the answer which is ":"
and save only this
answer = sendData("AT+CGNSINF", 1000, DEBUG);// get GPS data
delay(1000);
int GPS_Data_Start = answer.indexOf(':');
answer = answer.substring(GPS_Data_Start);
answer_size = answer.length();
SerialUSB.println("the replay from the modem was - \n\r");
SerialUSB.println(answer);
SerialUSB.println("the size is - \n\r");
SerialUSB.println(answer_size);
but it print me the same thing
the replay from the modem was -
AT+CGNSINF
+CGNSINF: 0,,,,,,,,,,,,,,,,,,,,
OK
the size is -
52
can you see what I did wrong ?
I thought and I will send the all answer and run the gps analysis in my server
Thanks ,