Go Down

Topic: programming and storage  (Read 161 times) previous topic - next topic

boudriga

 i'm really stuck and i seek for your help i'm using arduino mega SDK and GPRS(CELLULAR AND POSITIONING SHIELD 2.5G/GSM (SARA-G350)) ,i'm trying to send my car coordinations to my data base using AT commands but it wouldn't work. please can any body answer me as soon as possible

AWOL

Answer what?
There's no question.
There's no code, no schematic and no observations either.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

boudriga

#2
Jun 13, 2018, 12:24 pm Last Edit: Jun 13, 2018, 12:36 pm by boudriga
sorry it's my first time this is my code it send alerte message (it works)but  i want to send the coordiations to my database but that dosen't work so my question is : what's wrong in this code so i can be able to send data to my database


PaulS

Quote
but that dosen't work
That is a completely useless statement. The code does SOMETHING. You have to tell us what it actually does, and how that differs from what you want it to do.

Code: [Select]
   for (int k = 0; k < c ; k++) {
       if (gps.encode(buff[k]))
      displayInfo();
}

Your curly brace positioning and piss-poor indenting make your code VERY hard to follow. What IS that code actually doing?

Notice how much easier it is to answer that question when properly formatted:
Code: [Select]
   for (int k = 0; k < c ; k++)
   {
      if (gps.encode(buff[k]))
         displayInfo();
   }


Regardless of whether or not the encode() method said that the character added completed a sentence, you then have this code:
Code: [Select]
latitude=gps.location.lat();
longitude=gps.location.lng();
vitesse=gps.speed.kmph();
hourr=gps.time.hour();
minutee=gps.time.minute();
secondd=gps.time.second();

There may be no valid data (yet), but you ASSume that there is. Not a good idea.

Code: [Select]
          SIM900.print("\r");   // Envoyer un retour à la ligne <CR>
          delay(1000);                    // Attendre une seconde que le modem retourne "OK"
          SIM900.print("AT+CMGF=1\r");  // Envoyer un SMS en mode texte
          delay(1000);

Doesn't it matter that the SIM900 might have said "What the f**k are you talking about?"


The art of getting good answers lies in asking good questions.

Go Up