0

The code used for interfacing the gsm module with arduino for sending a message is as follows :-

#include <GSM.h>
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;
// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "12125551212"; 
// char array of the message
char txtMsg[200]="Test";
void setup()
{
 // initialize serial communications
 Serial.begin(9600);
 Serial.println("SMS Messages Sender");
 // connection state
 boolean notConnected = true;
 // Start GSM shield
 // If your SIM has PIN, pass it as a parameter of begin() in quotes
 while(notConnected)
 {
 if(gsmAccess.begin(PINNUMBER)==GSM_READY)
 notConnected = false;
 else
 {
 Serial.println("Not connected");
 delay(1000);
 }
 }
 Serial.println("GSM initialized");
 sendSMS();
}
void loop()
{
// nothing to see here
}
void sendSMS(){
 Serial.print("Message to mobile number: ");
 Serial.println(remoteNumber);
 // sms text
 Serial.println("SENDING");
 Serial.println();
 Serial.println("Message:");
 Serial.println(txtMsg);
 // send the message
 sms.beginSMS(remoteNumber);
 sms.print(txtMsg);
 sms.endSMS(); 
 Serial.println("\nCOMPLETE!\n"); 
}

the error is found on the 3rd line GSM_SMS sms; as GSM_SMS is not a name type. what point am i missing here...??

thank you in advance.

asked Mar 4, 2015 at 8:04
1
  • 1
    Which version of the Arduino IDE are you using? Commented Mar 4, 2015 at 9:18

1 Answer 1

1

Update your IDE software. You need IDE 1.0.4 or later. I copied your code into my 1.0.5 IDE and compiled it without any error. So it is most probably your version of the Arduino IDE.

answered Mar 4, 2015 at 10:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.