Problem read with SIM900

Hello,

I'm a french student in electronic and i have a problem with my arduino code. I'm trying to read a sms with arduino. I have a SIM900 from Efcom. I used this library GitHub - per/gsmshield: Arduino library for EFCom GPRS/GSM Shield

Here my code :

#include "SIM900.h"
#include "sms.h"
#include "GSM.h"
#include <SoftwareSerial.h>
 
int numdata;
boolean started=false; //  flag started false
char smsbuffer[160];
char n[20];

SMSGSM sms;
 
void setup()
{
     //Init of serial port
     Serial.begin(9600);
     Serial.println("Test du shield GSM...");
     
     //Config GSM
     if (gsm.begin(2400)) 
     {
       Serial.println("ETAT=READY");
       started=true; // get flag true => shield ready
     } 
     else Serial.println("ETAT=IDLE");

//-------------- SEND A SMS ------------------------------- 
     if(started) 
     {
       if (sms.SendSMS("+336*******0", "Arduino test "))
     
       Serial.println("SMS sent");
     }
     
}
 
void loop()
{

GSM gsm;

     if(started) 
     {

        char pos ;
        char phone_num[20]; // array for the phone number string
        char sms_text[100];

        pos = sms.IsSMSPresent(SMS_UNREAD);
          
          if (pos) {
          // read new SMS
          gsm.GetSMS(pos, phone_num, sms_text, 100);
          // now we have phone number string in phone_num
          Serial.println(phone_num);
          // and SMS text in sms_text
          Serial.println(sms_text);

          }
     }
   
}

And my problem because of this line : gsm.GetSMS(pos, phone_num, sms_text, 100);

I get this error : 'class GSM' has no member named 'GetSMS' and i do not know why. Someone could help me ??

Many thanks !

Did you look at the examples that came with the library? Where does the SMS example include GSM.h?

The GSM library is NOT for your hardware. You are confusing the compiler using two different libraries that try to do the same thing.

Hi PaulS,

if you use the SIM900, you cannot use the "GSM.h" Library because she was made for the GSM Shield from Arduino or Arduino Shield which work with the Quectel M10 for example.
So remove the "GSM.h" Library and try to use the AT-command on the serial Monitor.

Je vais le dire aussi en francais.
La Librairie "GSM.h" est concue à la base pour les cartes labelisée arduino comme le Arduino GSM Shield avec un processeur Quectel M10. Alors il y a conflict en cas d'utilisation de deux librairies sensées faire la même chose dont une n'est pas appropriée à la carte que tu utilises en l'occurence la SIM900.

Alors tu gardes la "SIM900.h" et selon moi la "SoftwareSerial.h" et tu cherches dans la rubrique:
Forum->Products->Arduino GSM Shield und code où les commandes AT sont utilisées à partir du Serial Monitor.

De cette manière je crois que ca devrait marcher pour toi. Bon courage et bonne semaine :slight_smile: