Error in GSM code

Hello,

I am hoping someone can give me some guidence with an error I am getting with an error I am getting.

The error code is

Using_GSM_and_GPS.cpp:77:18: error: invalid digit "9" in octal constant

I think the issues is with the following line

gsm.makeCall("077xxxxxxxx");

If I leave the quotation marks around the number the program will upload with no issues, but the GSM/GPS shield will not send the GPS information through a text message. If I take the quotation marks away, I get the above error message.

Thanks in advance for any help or advice.

Seán

If you specify a number like 12, the number is assumed to be base 10 (decimal). If you specify the number like 012, the number is assumed to be base 8 (octal). The first x you show must actually be a 9, right? Base 8 numbers contain digits 0 through 7 only. So, a 9 in a base 8 number would be an error, as the message is telling you.

You'd need to tell us something about the gsm object you are calling the method makeCall() on, for us to provide any real help. The gsm.makeCall() function expects some kind of input. That may be a string, so the double quotes are required. Or it may be something else. Only you know for sure.

Hello,

Thanks for the reply. And, yes, you are right, the first x is a 9!

Since I am pretty new to the Arduino way of thing (I am coming over from PICs and trying to get the hang of Arduino for a final year uni project) I will just post the full code if that is okay.

I didn't write this myself, it was supplied with the shield I got from this here -- http://www.antrax.de/en/Wireless-GPS/Development-Tools/Arduino-Platform/GSM-GPRS-GPS-Shield-Kit.

#include <GSM_GPS_Shield.h>

int switch_gsm;
int switch_gps;
int i;
int led_mode = 0;

GSM gsm(7,9600);                                                                // (power_pin, baudrate)
GPS gps(7,9600);                                                                // (power_pin, baudrate)

void setup()
{
  Serial.begin(9600);
  
  pinMode(14, INPUT);                                                           // GSM-Button
  pinMode(15, INPUT);                                                           // GPS-Button
  pinMode(9, OUTPUT);                                                           // LED-GPS 

  digitalWrite(14, HIGH); 
  digitalWrite(15, HIGH);
}

void loop()
{
  gps.getGPS();
  
  Serial.println(gps.coordinates);
  
  for(i = 0; i < 80; i++)                                                       // check GPS-Coordinates
  {
    if(gps.gps_data[i] == 'N')
    {
      led_mode = 1;
    }
  }
  
  if(led_mode == 1)
  {
    delay(300);
    digitalWrite(9, HIGH); 
    delay(500);
    digitalWrite(9, LOW);
  }
  else
  {
    delay(20);
    digitalWrite(9, HIGH); 
    delay(20);
    digitalWrite(9, LOW);
    delay(20);
    digitalWrite(9, HIGH); 
    delay(20);
    digitalWrite(9, LOW);
  }

  switch_gsm = digitalRead(14);                                                 // Read status of the switch_gsm
  switch_gps = digitalRead(15);                                                 // Read status of the switch_gps

  if(switch_gsm == 0)                 
  {
    gsm.initializeGSM("Your SIM-Pin");                                          // Enter your SIM-Pin if it's required
    delay(200);
    gsm.makeCall(077xxxxxxxx);                             // Enter the Destination-Phone-Number
  }
  if(switch_gps == 0)                 
  {
    gsm.initializeGSM("Your SIM-Pin");                                          // Enter your SIM-Pin if it's required
    delay(200); 
    gsm.sendSMS(077xxxxxxxx,gps.coordinates);              // Enter the Destination-Phone-Number
  }
}

Again, thank you.

Seán

The mix of German and English at that site prevents me from finding and downloading a copy of the GSM_GPS_Shield library, so I can't see what the calling arguments for sendSMS are. It seems hard to believe that the phone number to call would be entered as a number, though.

Hello,

Thanks for the reply.

I also contacted the company who produced this particular shield, and they said that the number has to be entered with the quotation marks.

I tried to post in the code here for the GSM_GPS_Shield library, but I went beyond some character limit, so here is the link where I downloaded them from.

Support - ANTRAX ...It's about 3/4 way down the page.

Thanks

Seán

The manufacturer got back to me again -- they said to try connecting a power supply, because the call may need an extra bit of power, so I will try that this evening.

Seán

The method signature for makeCall() is:

void GSM::makeCall(char number[50])

The code ultimately uses the provided number this way:

                Serial.print("ATD ");
                Serial.print(number);
                Serial.println(";");

You would want to pass it a string rather than an integer. I think something like "+4977xxx" would be good. The Antrax sample code should probably be cleaned up, as they omit quotes on the example which could lead to this misunderstanding.

The O/P never really explained what went wrong when calling makeCall() with a string. If things didn't work out, it is entirely possible that there was a hardware issue and inadequate power supply would be the top of my list to check out. This module can likely draw over 1,000ma when transmitting, and the resulting voltage dropout could cause havoc.

o.fithcheallaigh:
The manufacturer got back to me again -- they said to try connecting a power supply, because the call may need an extra bit of power, so I will try that this evening.

Seán

Sean,

I am using a different shield - but this issue is similar to one I had,

If I was running from a battery I couldn't connect to the GSM network as it draws > 1A when attempting the GSM connection,

If I power it using USB or an external power source (power supply) it worked fine,

So could be a similar issue,

Cheers,

Dave

Hello,

I connected the board up with the power supply attached etc., but still no luck.

I was able to check the serial monitor and I am receiving GPS information. But when I hit the button to either make a test call or to send the information I get the following information.

54 08.xxxxx, 06 18.xxxxx
54 08.xxxxx, 06 18.xxxxx
54 08.xxxxx, 06 18.xxxxx
AT
ÿ
A
T

O
K

ATE0

A
T
E
0

O
K

AT+IPR=9600

O
K

AT+CPIN?

E
R
R
O
R

ÿ
ÿ
ÿ

Now, this is beyond anything I can try to sort out, so I thought I would post it here, but I am also sending it to the manufacturer, in case it is an error in the shield.

Seán

Is your SIM card locked?

Well, it was a brand new SIM, so shouldn't be ...also, I tried a family members SIM card, and still no go.

Seán

Try it with the SIM card removed. See if you get the same ERROR or if you get SIM NOT INSERTED.

Oh, never thought of trying that, thanks!!

It will be tomorrow before I get a chance to do it though ...I am finishing off a mathematics assignment at the minute, and still have to answer a few questions for an embedded systems assignment ...and it is getting late here ...but I will try it. Thanks a lot!

Seán

Hello,

Just an update for anyone who replied, or was just interested :slight_smile:

Finially got the Shield up and going ...Had to get the help from the manufacturer ...it seems that there was a problem with the connection between the SIM an the gsm module. The command AT#SIMDET=1 needed to be entered before checking the pinstate, in the GSM_GPS_Shield.cpp file.

Once this was done, it worked fine.

Thanks to everyone for all your time and help!

Go raibh mile maith agat mo cairde!!

gilmorenator:

o.fithcheallaigh:
The manufacturer got back to me again -- they said to try connecting a power supply, because the call may need an extra bit of power, so I will try that this evening.

Seán

Sean,

I am using a different shield - but this issue is similar to one I had,

If I was running from a battery I couldn't connect to the GSM network as it draws > 1A when attempting the GSM connection,

If I power it using USB or an external power source (power supply) it worked fine,

So could be a similar issue,

Cheers,

Dave

I'm using Arduino Atmega8 board, and SIM300 gsm modem, i need to to know can i display/read messages from GSM modem using Arduino,
help needed.
Thanks.