Seeed-Studio / Seeeduino_GPRS

Seeeduino GPRS Library
http://www.seeedstudio.com/depot/Seeeduino-GPRS-p-1909.html
MIT License
90 stars 57 forks source link

How to send Latitude and longitude inside SMS using sim800? #5

Closed Pritha01 closed 8 years ago

Pritha01 commented 8 years ago

Hello everyone!

I am using Ublox Neo 6M for location, Arduino Uno and sim800 GSM module for sending SMS. I have created following function:

` bool sendLocation(char* number, String latitude, String longtitude) {

Serial.println("Sending SMS...");
serialSIM800.println("AT+CSCS=\"GSM\"");
serialSIM800.println("AT+CMGF=1");
serialSIM800.print("AT+CMGS=\"");
serialSIM800.print(number);
serialSIM800.println("\"");
serialSIM800.print("LAT: ");
serialSIM800.println(latitude);
serialSIM800.print("LON: ");
serialSIM800.println(longtitude);
serialSIM800.println((char)26);
 return true;

}`

My program doesn't show any error, but It doesn't send the SMS. Even though it enters the function and prints "Sending SMS" but no SMS is received on specified mobile number. Can anybody help me please?

jalexc commented 8 years ago

I'm using some small delays(100) in my code, and ending with an empty println(). I believe I was having some problems like yours.

My code is like:

serialSIM800.print(F("AT+CMGS=\""));
serialSIM800.print(number);
serialSIM800.println('"');
delay(100);
serialSIM800.println( YOUR TEXT );
...
delay(100);
serialSIM800.println((char)26);
delay(100);
serialSIM800.println();

Try it out

Pritha01 commented 8 years ago

Thanks alot!!!!!!!! It worked!! :)