Dear All,
I have a script which collect the GPS coordinate. Each minute it send it to a server.
For several reason, I would like that the Arduino Mini pro keep in memory the collected coordinate for 5 minutes and then send it to the server.
In other words, the loop collect the coordinate each minute.
The arduino keep in memory the the coordinate collected each minute.
After 5 minutes (or more..) it send all collected coordinate.
My first question would be how to recoord the data and send all in one block
Here is an exemple of my sendDATA function wich works fine. That function ius called each minute
void SendData(void){
#ifdef DEBUG
Serial.println(F(""));
Serial.println(F("\nSENDING COORDS TO THE REMOTE SERVER"));
Serial.println(F("---------------------------------------"));
#endif
stat=gps.getStat();
#ifdef DEBUG
if(stat==0){
Serial.println(F("GPS OFF"));
Serial.println(F("No coords sent"));
}else if(stat==1){
Serial.println(F("NOT FIXED"));
Serial.println(F("No coords sent"));
}else if(stat==2){
Serial.println(F("2D FIXED"));
}else if(stat==3){
Serial.println(F("3D FIXED"));
}
#endif
//Get data from GPS
// Send the data only if the are FIXes, otherwise give up the send function
// This is to avoid battery consomation
if(stat == 2 || stat == 3){
gps.getPar(lon,lat,alt,time,vel);
#ifdef DEBUG
Serial.println(lat);
Serial.println(lon);
#endif
char coords[97];
// Convert Int to char
char course_id[6] = {0};
sprintf(course_id, "%d", courseid);
puts(course_id);
strcpy(coords,co); //3
strcat(coords,course_id);
//strcpy(coords,lo); //3
strcat(coords,lo); //3
strcat(coords,lon);
strcat(coords,la); //22
strcat(coords,lat);
strcat(coords,al); //41
strcat(coords,alt);
strcat(coords,ti); //60
strncat(coords,time,14); //74
strcat(coords,ve); //78
strcat(coords,vel);
#ifdef DEBUG
Serial.println(F("Sending now... . Wait for 5 to 10 seconds"));
#endif
// Send the data to the server
inet.httpPOST(host, port_post, path_post, coords, "Result", 0);
#ifdef DEBUG
Serial.print(F("Data sent : "));
Serial.println(coords);
Serial.println(F("Wait for 10 second"));
#endif
delay(10000);
}
enterCommand();
}
// End sendDATA()
I will ask my second question in a new post as the question is different but related to it
Thank a lot cheers