Go Down

Topic: Send a variable (Read 1 time) previous topic - next topic

xhelioneto

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"
SMSGSM sms;

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

//GSM Shield for Arduino
//www.open-electronics.org
//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.begin(9600);
  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)){
    Serial.println("\nstatus=READY");             
    started=true; 
  }
  else Serial.println("\nstatus=IDLE");
 
  if(started){                                       
    //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()
{
  if(started){
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))
    {
      Serial.println(n);
      Serial.println(smsbuffer);
    }
    delay(1000);
  }
};

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.

HugoPT

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

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

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!

Arduino
via Egeo 16
Torino, 10131
Italy