GSM.h depreciated / not working

So, I loaded up the example code for recieving SMS with a GSM shield.

I get the following warnings from the example code :

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

from C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_595768\ReceiveSMS.ino:21:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_595768\ReceiveSMS.ino:50:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (gsmAccess.begin(PINNUMBER) == GSM_READY) {

^

I tried to serial print gsmAccess.begin(PINNUMBER) and I got no output.

The example code never gets past

while (notConnected) {
Serial.println(gsmAccess.begin(PINNUMBER));
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
}
}

niether does it say "Not connected" nor does it leave the loop as the line
Serial.println("GSM initialized");
never triggers.

I have done no modifications to the example code (Examples>GSM>RecieveSMS) .

Can anyone explain to me why this code doesn't work ?

So, I loaded up the example code for recieving SMS with a GSM shield.

I get the following warnings from the example code :

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

from C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_595768\ReceiveSMS.ino:21:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_595768\ReceiveSMS.ino:50:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (gsmAccess.begin(PINNUMBER) == GSM_READY) {

^

I tried to serial print gsmAccess.begin(PINNUMBER) and I got no output.

The example code never gets past

while (notConnected) {
Serial.println(gsmAccess.begin(PINNUMBER));
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
}
}

niether does it say "Not connected" nor does it leave the loop as the line
Serial.println("GSM initialized");
never triggers.

I have done no modifications to the example code (Examples>GSM>RecieveSMS) .

Can anyone explain to me why this code doesn't work ?

No idea.

But calling a begin() function twice might not be a good idea.

Store the result of gsmAccess.begin(PINNUMBER) in a variable and print that variable and use that variable in the condition in the if statement.

PS
By the way, the specific warnings are harmless.

Yes,

I tried that. I tried to save it into a variable and println that variable. nothing was displayed.

It doesn't work when removing the serial.println(gsmAccess.begin(PINNUMBER)) either.

BTW the full code looks like this

/*
SMS receiver

This sketch, for the Arduino GSM shield, waits for a SMS message
and displays it through the Serial port.

Circuit:

  • GSM shield attached to and Arduino
  • SIM card that can receive SMS messages

created 25 Feb 2012
by Javier Zorzano / TD

This example is in the public domain.

*/

// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER "6141"

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.println("SMS Messages Receiver");

// connection state
boolean notConnected = true;

// Start GSM connection
while (notConnected) {
Serial.println(gsmAccess.begin(PINNUMBER));
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
}
}

Serial.println("GSM initialized");
Serial.println("Waiting for messages");
}

void loop() {
char c;

// If there are any SMSs available()
if (sms.available()) {
Serial.println("Message received from:");

// Get remote number
sms.remoteNumber(senderNumber, 20);
Serial.println(senderNumber);

// An example of message disposal
// Any messages starting with # should be discarded
if (sms.peek() == '#') {
Serial.println("Discarded SMS");
sms.flush();
}

// Read message bytes and print them
while (c = sms.read()) {
Serial.print(c);
}

Serial.println("\nEND OF MESSAGE");

// Delete message from modem memory
sms.flush();
Serial.println("MESSAGE DELETED");
}

delay(1000);

}

Anyone can try to compile this code because it IS the example code/tutorial code for recieving SMS by GSM.

I tried uploading this example code on to a Arduino Mega 2560 and got the following warnings.

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

from C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_835628\ReceiveSMS.ino:21:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

^

C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_835628\ReceiveSMS.ino: In function 'void setup()':

C:\Users\Kevin\AppData\Local\Temp\arduino_modified_sketch_835628\ReceiveSMS.ino:50:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BOB = gsmAccess.begin(PINNUMBER);

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp: In constructor 'GSM3MobileMockupProvider::GSM3MobileMockupProvider()':

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp:44:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

msgExample="Hello#World";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp: In member function 'int GSM3MobileMockupProvider::connectTCPServer(int, char*, int*)':

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp:183:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

strcpy("192.168.1.1", localIP);

^

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:34:0:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp: In constructor 'GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool)':

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:38:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[UNDEFINED]="";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:39:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[EGSM_MODE]=""EGSM_MODE"";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:40:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[DCS_MODE]=""DCS_MODE"";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:41:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[PCS_MODE]=""PCS_MODE"";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:42:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[EGSM_DCS_MODE]=""EGSM_DCS_MODE"";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:43:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

quectelStrings[GSM850_PCS_MODE]=""GSM850_PCS_MODE"";

^

C:\Program Files (x86)\Arduino\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"";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ModemCore.cpp:39:14: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

char* ok="OK";

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ModemVerification.cpp: In member function 'String GSM3ShieldV1ModemVerification::getIMEI()':

C:\Program Files (x86)\Arduino\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);

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1SMSProvider.cpp: In member function 'void GSM3ShieldV1SMSProvider::beginSMSContinue()':

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1SMSProvider.cpp:68:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, ">"))

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getCurrentCarrier()':

C:\Program Files (x86)\Arduino\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);

^

C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getSignalStrength()':

C:\Program Files (x86)\Arduino\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);

^

Also, I have had this example work on the same arduino about 4 years ago.

By the way, I am using a GSM Playground v1.6

Aparently GSM is obosolete ...

DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=554968
I HAVE REPORTED THIS THREAD TO THE MODERATORS

Threads merged.