sendSMS java error

Hi everyone, i’m trying to play with a GSM module. i started with the sendSMS and makeCall example sketches but get the following error
i wasn’t sure if it was because of my mac so i tried on my windows laptop and get the same problem.

the sketch uploads and in serial monitor it comes up with ‘sms message sender’ but then nothing else.

In file included from /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM.h:46:0,
                 from /Applications/Arduino.app/Contents/Java/libraries/GSM/examples/SendSMS/SendSMS.ino:25:
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration [enabled by default]
 typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
                                                                                                                             ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/examples/SendSMS/SendSMS.ino: In function 'void setup()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/examples/SendSMS/SendSMS.ino:48:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
                                  ^

this is the shield i’m using:

I suppose you are trying the default sendSMS example located at

/Applications/Arduino.app/Contents/Java/libraries/GSM/examples/SendSMS/SendSMS.ino

Your issue has nothing to do with a Java error.

Try changing:at the beginning of the sketch

#define PINNUMBER "" into char PINNUMBER[] = "";

and of course if your SIM card has a pin then declare it there... like char PINNUMBER[] = "1234";

On your mac, in the finder type cmd-shift-G (or use and paste the following path in the little window

/Applications/Arduino.app/Contents/Java/libraries/GSM/src/ and click OK.

In the finder window that appears, locate the GSM3ShieldV1BandManagement.h file

open that files in your favorite code editor and locate the line

[color=red]typedef[/color] enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

comment out that line and duplicate it and remove the typedef

// Modified to fit more recent IDE
// was  [color=red]typedef[/color] enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
// removed the typedef
enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

save that file and try again to compile and see if you get any compilation warning.

Thanks very much for your reply! i've done everything you say but still get the following:

i know the arduino side of things but all these errors are baffling me :'(

/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp: In constructor 'GSM3MobileMockupProvider::GSM3MobileMockupProvider()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp:44:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  msgExample="Hello#World";

            ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp: In member function 'int GSM3MobileMockupProvider::connectTCPServer(int, char*, int*)':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp:183:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   strcpy("192.168.1.1", localIP);

                                ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp: In constructor 'GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool)':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:38:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[UNDEFINED]="";
                           ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:39:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[EGSM_MODE]="\"EGSM_MODE\"";
                           ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:40:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[DCS_MODE]="\"DCS_MODE\"";
                          ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:41:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[PCS_MODE]="\"PCS_MODE\"";
                          ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:42:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[EGSM_DCS_MODE]="\"EGSM_DCS_MODE\"";
                               ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:43:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[GSM850_PCS_MODE]="\"GSM850_PCS_MODE\"";
                                 ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:44:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  quectelStrings[GSM850_EGSM_DCS_PCS_MODE]="\"GSM850_EGSM_DCS_PCS_MODE\""; 
                                          ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemCore.cpp:39:14: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 char* __ok__="OK";
              ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp: In member function 'String GSM3ShieldV1ModemVerification::getIMEI()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp:64:20: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
  String number(NULL);
                    ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp: In member function 'void GSM3ShieldV1SMSProvider::beginSMSContinue()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp:68:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, ">"))
                                                         ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getCurrentCarrier()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp:66:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
   return String(NULL);
                     ^
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getSignalStrength()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp:85:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
   return String(NULL);
                     ^

Sketch uses 14,506 bytes (44%) of program storage space. Maximum is 32,256 bytes.
Global variables use 983 bytes (47%) of dynamic memory, leaving 1,065 bytes for local variables. Maximum is 2,048 bytes.

Is this in your code?

strcpy("192.168.1.1", localIP);

This can't work. With strcpy the destination buffer should be first

young_skywalker: Thanks very much for your reply! i've done everything you say but still get the following:

i know the arduino side of things but all these errors are baffling me :'(

/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp: In constructor 'GSM3MobileMockupProvider::GSM3MobileMockupProvider()':
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp:44:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  msgExample="Hello#World";

            ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp: In member function 'int GSM3MobileMockupProvider::connectTCPServer(int, char*, int*)': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3MobileMockupProvider.cpp:183:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   strcpy("192.168.1.1", localIP);

                                ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp: In constructor 'GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool)': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:38:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[UNDEFINED]="";                           ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:39:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[EGSM_MODE]="\"EGSM_MODE\"";                           ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:40:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[DCS_MODE]="\"DCS_MODE\"";                           ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:41:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[PCS_MODE]="\"PCS_MODE\"";                           ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:42:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[EGSM_DCS_MODE]="\"EGSM_DCS_MODE\"";                               ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:43:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[GSM850_PCS_MODE]="\"GSM850_PCS_MODE\"";                                 ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.cpp:44:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   quectelStrings[GSM850_EGSM_DCS_PCS_MODE]="\"GSM850_EGSM_DCS_PCS_MODE\"";                                           ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemCore.cpp:39:14: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] char* ok="OK";               ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp: In member function 'String GSM3ShieldV1ModemVerification::getIMEI()': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ModemVerification.cpp:64:20: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]   String number(NULL);                     ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp: In member function 'void GSM3ShieldV1SMSProvider::beginSMSContinue()': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1SMSProvider.cpp:68:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]   if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, ">"))                                                         ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getCurrentCarrier()': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp:66:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]   return String(NULL);                     ^ /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getSignalStrength()': /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1ScanNetworks.cpp:85:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]   return String(NULL);                     ^

Sketch uses 14,506 bytes (44%) of program storage space. Maximum is 32,256 bytes. Global variables use 983 bytes (47%) of dynamic memory, leaving 1,065 bytes for local variables. Maximum is 2,048 bytes.

Those are warnings, not errors. Big difference. We need to look at the code to see why it's not working. Can you post that where we can see it? Not a link to where you got it, but an actual copy-paste of what is in your IDE window.

Delta_G: Those are warnings, not errors. Big difference. We need to look at the code to see why it's not working. Can you post that where we can see it? Not a link to where you got it, but an actual copy-paste of what is in your IDE window.

The OP is using the standard built in example provided in the GSM folder (GSM/examples/SendSMS/SendSMS.ino) so we all have the code.

This uses old style libraries and the parser/compiler got less permissive about what it allows or not to prevent programming errors. That's what all the warnings are about.

The modifications I proposed above do lead to proper compile without any warning with a UNO for the default sketch.

The strcpy thingy I mention in post #3 though is definitely an issue. You can't stuff data in a constant string.