Go Down

Topic: Send a variable (Read 2751 times) previous topic - next topic


hi everyone, i'm using a GPS Module + arduino uno + Shield GSM. I'm trying to send a variable for message using this example here:
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;                           
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
  //Serial connection.
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
  else Serial.println("\nstatus=IDLE");
    //Enable this two lines if you want to send an SMS.
    if (sms.SendSMS("xxxxxxx", "Test send sms"))
      Serial.println("\nSMS sent OK");


void loop()
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))

But, I don't know how to send a variable in place of text message. I've tried this in this line:
if (sms.SendSMS("xxxxxxx", "Test send sms"))
for this:
if (sms.SendSMS("xxxxxxx", var1))

note: var1 is my variable that read the latitude and longitude of GPS Module. Is a char var1[15];

This didn't work

Can you help me to send a variable in place of text message? If you have a better example to send sms and you think with your example you can send a variable, please show me!
My GSM Shield is this: http://imall.iteadstudio.com/im120417009.html
I don't know English very well. I'm sorry for my mistakes.


Code: [Select]
if (sms.SendSMS("xxxxxxx", "Test send sms"))
for this:
if (sms.SendSMS("xxxxxxx", var1))

Does the var1 correct terminated using '\0' ?
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


im facing the same problem.. is it possible to send variable in place of text message?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131