Trouble with SIM900 GSM/GPRS library (SOLVED)

So i’m not very good at all this arduino-stuff but i understand the basics and a tiny bit more, and i somehow decided to make this schoolproject where i inter alia, need a GSM/GPRS-shield, so i bought one… which apparently wasn’t the official one, so it needs a special library, and not the GSM liabrary there already is in the IDE, so i downloaded and installed it (from http://code.google.com/p/gsm-shield-arduino/downloads/detail?name=GSM_GPRS_GPS_IDE100_v307.zip&can=2&q=. Just for testing i took a random example which was for calling. the code for the example was:

#include "SIM900.h"
#include <SoftwareSerial.h>
//We don't need the http functions. So we can disable the next line.
//#include "inetGSM.h"
#include "sms.h"
#include "call.h"

//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 check if an incoming call is from an authorized
//number and in this case, send to this number an SMS with the value
//of a digital input.

//We have to create the classes for SMSs and calls.
CallGSM call;
SMSGSM sms;

char number[20];
byte stat=0;
int value=0;
int pin=1;
char value_str[5];

void setup() 
{
  pinMode(pin,INPUT);
  //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");
  else Serial.println("\nstatus=IDLE");
};

void loop() 
{
  //Chekcs status of call
  stat=call.CallStatusWithAuth(number,1,3);
  //If the incoming call is from an authorized number
  //saved on SIM in the positions range from 1 to 3.
  if(stat==CALL_INCOM_VOICE_AUTH){
    //Hang up the call.
    call.HangUp();
    delay(2000);
    //Check the value of the input.
    value=digitalRead(1);
    //Convert the int to a string.
    itoa(value,value_str,10);
    //Send an SMS to the previous number with
    //the value read previously.
    sms.SendSMS(number,value_str);
  }
  delay(1000);
};

As said, im not a pro but i think that looks okay. But it returned an error saying:

gps.cpp: In function ‘double convertLat()’:
gps.cpp:184: error: ‘latString’ was not declared in this scope
gps.cpp: In function ‘double convertLong()’:
gps.cpp:193: error: ‘longString’ was not declared in this scope

as i see it, it says that there’s something wrong with “gps.cpp”, which i think is weird because that library (i think it’s a library, right?) isn’t even mentioned in the code, anyway, i think the only solution is to fix the error, whatever it is, in “gps.ccp”. And that is where i’m lost, because the “gps.cpp” file looks like Arabic to me, i dont get a single word of it. :~
gps.cpp:

#include "gps.h"
char GPSGSM::getBattInf(char *str_perc, char *str_vol){
	char ret_val=0;
	char *p_char; 
	char *p_char1;

	gsm.SimpleWriteln("AT+CBC");
	gsm.WaitResp(5000, 100, "OK");
	if(gsm.IsStringReceived("+CBC"))
		ret_val=1;
		
	//BCL
	p_char = strchr((char *)(gsm.comm_buf),',');
	p_char1 = p_char+1;  //we are on the first char of BCS
	p_char = strchr((char *)(p_char1), ',');
	if (p_char != NULL) {
          *p_char = 0; 
    }
	strcpy(str_perc, (char *)(p_char1));	
	
	//Voltage
	p_char++;
	p_char1 = strchr((char *)(p_char), '\r');
	if (p_char1 != NULL) {
          *p_char1 = 0; 
    }	
	strcpy(str_vol, (char *)(p_char));
	return ret_val;
}

char GPSGSM::getBattTVol(char *str_vol){
	char *p_char; 
	char *p_char1;
	char ret_val=0;
	
	gsm.SimpleWriteln("AT+CBTE?");
	gsm.WaitResp(5000, 100, "OK");
	if(gsm.IsStringReceived("+CBTE"))
		ret_val=1;	
		
	//BCL
	p_char = strchr((char *)(gsm.comm_buf),':');
	p_char1 = p_char+2;  //we are on the first char of BCS
	p_char = strchr((char *)(p_char1), '\r');
	if (p_char != NULL) {
          *p_char = 0; 
    }
	strcpy(str_vol, (char *)(p_char1));	
	return ret_val;
}

char GPSGSM::attachGPS() 
{
	if(AT_RESP_ERR_DIF_RESP == gsm.SendATCmdWaitResp("AT+CGPSPWR=1", 500, 100, "OK", 5))
		return 0;
	if(AT_RESP_ERR_DIF_RESP == gsm.SendATCmdWaitResp("AT+CGPSRST=1", 500, 100, "OK", 5))
		return 0;
	return 1;
}

char GPSGSM::deattachGPS() 
{
	if(AT_RESP_ERR_DIF_RESP == gsm.SendATCmdWaitResp("AT+CGPSPWR=0", 500, 100, "OK", 5))
		return 0;
	return 1;
}

char GPSGSM::getStat() 
{
	char ret_val=-1;
	gsm.SimpleWriteln("AT+CGPSSTATUS?");
	gsm.WaitResp(5000, 100, "OK");
	if(gsm.IsStringReceived("Unknown")||gsm.IsStringReceived("unknown"))
		ret_val=0;
	else if(gsm.IsStringReceived("Not"))
		ret_val=1;
	else if(gsm.IsStringReceived("2D")||gsm.IsStringReceived("2d"))
		ret_val=2;
	else if(gsm.IsStringReceived("3D")||gsm.IsStringReceived("3d"))
		ret_val=3;
	return ret_val;
}

char GPSGSM::getPar(char *str_long, char *str_lat, char *str_alt, char *str_time, char *str_speed) 
{
	char ret_val=0;
	char *p_char; 
	char *p_char1;
	gsm.SimpleWriteln("AT+CGPSINF=0");
	gsm.WaitResp(5000, 100, "OK");
	if(gsm.IsStringReceived("OK"))
		ret_val=1;
		
	//longitude
	p_char = strchr((char *)(gsm.comm_buf),',');
	p_char1 = p_char+1;  //we are on the first char of longitude
	p_char = strchr((char *)(p_char1), ',');
	if (p_char != NULL) {
          *p_char = 0; 
    }
	strcpy(str_long, (char *)(p_char1));
	
	// latitude
	p_char++;
	p_char1 = strchr((char *)(p_char), ',');
	if (p_char1 != NULL) {
          *p_char1 = 0; 
    }	
	strcpy(str_lat, (char *)(p_char));
	
	// altitude
	p_char1++;
	p_char = strchr((char *)(p_char1), ',');
	if (p_char != NULL) {
          *p_char = 0; 
    }	
	strcpy(str_alt, (char *)(p_char1));
	
	// UTC time
	p_char++;
	p_char1 = strchr((char *)(p_char), ',');
	if (p_char1 != NULL) {
          *p_char1 = 0; 
    }	
	strcpy(str_time, (char *)(p_char));	

	// TTFF
	p_char1++;
	p_char = strchr((char *)(p_char1), ',');
	if (p_char != NULL) {
          *p_char = 0; 
    }	

	// num
	p_char++;
	p_char1 = strchr((char *)(p_char), ',');
	if (p_char1 != NULL) {
          *p_char1 = 0; 
    }	

	// speed
	p_char1++;
	p_char = strchr((char *)(p_char1), ',');
	if (p_char != NULL) {
          *p_char = 0; 
    }		
	strcpy(str_speed, (char *)(p_char1));	
	
	return ret_val;
}

void parseTime(char *field, int *time) {
  ////////////////Time////////////
  char tmp[4];
  tmp[2]=0; // Init tmp and null terminate
  tmp[0] = field[8];
  tmp[1] = field[9];
  time[0] = atoi(tmp); // Hours
  tmp[0] = field[10];
  tmp[1] = field[11];
  time[1] = atoi(tmp); // Minutes
  tmp[0] = field[12];
  tmp[1] = field[13];
  time[2] = atoi(tmp); // Seconds
  /////////////Date///////////////
  tmp[0] = field[0];
  tmp[1] = field[1];
  tmp[2] = field[2];
  tmp[3] = field[3];
  tmp[4]=0; // Init tmp and null terminate
  time[3] = atoi(tmp); // year
  tmp[0] = field[4];
  tmp[1] = field[5];
  tmp[2]=0; // Init tmp and null terminate
  time[4] = atoi(tmp); // month
  tmp[0] = field[6];
  tmp[1] = field[7];
  tmp[2]=0; // Init tmp and null terminate
  time[5] = atoi(tmp); // day
}

// Read the latitude in decimal format from a GGA string
double convertLat(void) {
  double latitude = atof(latString);                                    // convert to a double (precise)
  int deg = (int) latitude / 100;                               // extract the number of degrees
  double min = latitude - (100 * deg);                  // work out the number of minutes
  latitude = deg + (double) min/60.0;                   // convert to decimal format
  return latitude;
}

// Read the longitude in decimal format from a GGA string
double convertLong(void) {
  double longitude = atof(longString);                                  // convert to a double
  int deg = (int) longitude / 100;                              // extract the number of degrees
  double min = longitude - (100 * deg);                 // work out the number of minutes
  longitude = deg + (double) min/60.00;                 // convert to decimal format
  return longitude;
}

So if anyone could check it or something it would be great! :slight_smile:
It’s my first post here so it might be a bit, i don’t know, wrong or something. And sorry for my english, i’m from Denmark

as i see it, it says that there's something wrong with "gps.cpp", which i think is weird because that library (i think it's a library, right?)

There's a header file and a source file. That, in Arduino-land makes it a library.

so i downloaded and installed it.

From where? Details are important.

So if anyone could check it or something it would be great!

There's a problem with that. See the clue above.

It's my first post here so it might be a bit, i don't know, wrong or something.

Welcome aboard. And, yes, it's something.

first i downloaded it from the website where i bought the GSM/GPRS shield (http://www.tinyosshop.com/datasheet/BETA_GSM_GPRS_GPS_IDE100_v302.zip.zip), i dont remember why, but it didnt work. Somehow i found the site where it was originally from (http://code.google.com/p/gsm-shield-arduino/downloads/list), i could see that the name was the same, exept the version i had was seriously old, so instead i downloaded the newest one "GSM_GPRS_GPS_IDE100_v307.zip"
And thanks for the quick reply!

so instead i downloaded the newest one

So, problem resolved?

no, thats where i ran into the "gps.cpp"-error message

no, thats where i ran into the "gps.cpp"-error message

The gps.cpp file in the library you linked to doesn't even have a convertLat() method, so I find that hard to believe.

correct me if im wrong but i think you used the first link (wich is usesless now, so im not quite sure why i mentioned it), where the file is GSM_BETA_V2 or something like that.
Im so sorry for mixing things, as said, im new :frowning:

Oliver2854:
correct me if im wrong but i think you used the first link (wich is usesless now, so im not quite sure why i mentioned it), where the file is GSM_BETA_V2 or something like that.
Im so sorry for mixing things, as said, im new :frowning:

I downloaded the wrong file, I see. There is a note on that page that the 3.07.1 version is elsewhere. I suggest that you track that down, to see if it addresses the problems.

yeah, could be. Thanks!

IT WAS! XD cant believe that was the only problem, haha, well i guess you just have to look at the small "unimportant" things sometimes. Thanks a lot! :slight_smile: