Pages: [1]   Go Down
Author Topic: Send a variable  (Read 1188 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1573
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
if (sms.SendSMS("xxxxxxx", "Test send sms"))
for this:
if (sms.SendSMS("xxxxxxx", var1))
Does the var1 correct terminated using '\0' ?
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Pages: [1]   Go Up
Jump to: