Go Down

Topic: Getting Errors even though I downloaded sample code...NEED HELP ASAP PLZ! (Read 1 time) previous topic - next topic

ArduinoNoobNeedHelp

so i am using a gsm shield sim900 with a tmobile sim card and an arduino uno...I used the SMS Sender code from this youtube link: https://www.youtube.com/watch?v=n-RkWRUw62g

However I get these errors liste below. IF YOU COULD PLEASE HELP ME ASAP I WOULD GREATLY APPRECIATE IT!

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void setup()':

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:49:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         if (sms.SendSMS("+19569758590", "Arduino SMS"))

                                                      ^

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:49:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void loop()':

SMSSender:69: error: no matching function for call to 'SMSGSM::GetSMS(char&, char [20], char [100], int)'

             sms.GetSMS(sms_position, phone_number, sms_text, 100);

                                                                 ^

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:69:65: note: candidate is:

In file included from C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:8:0:

C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD/sms.h:12:11: note: char SMSGSM::GetSMS(byte, char*, byte, char*, byte)

      char GetSMS(byte position, char *phone_number,byte max_phone_len, char *SMS_text, byte max_SMS_len);

           ^

C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD/sms.h:12:11: note:   candidate expects 5 arguments, 4 provided

exit status 1
no matching function for call to 'SMSGSM::GetSMS(char&, char [20], char [100], int)'


TolpuddleSartre

I'd love to help you, but you didn't post your code.

Quote
candidate expects 5 arguments, 4 provided
Seems pretty clear to me.

ArduinoNoobNeedHelp

here is my code:


#include <call.h>
#include <gps.h>
#include <GSM.h>
#include <HWSerial.h>
#include <inetGSM.h>
#include <LOG.h>
#include <SIM900.h>
#include <sms.h>
#include <Streaming.h>
#include <WideTextFinder.h>


   //////////////////////////////////////////////
  //        Arduino GSM SHIELD SMS         //
 //              Tutorial by                          //
//           http://www.educ8s.tv             //
/////////////////////////////////////////////


#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
    Serial.begin(9600);
   
    if (gsm.begin(9600))
    {
        Serial.println("\nstatus=READY");
        started=true;
    }
    else
        Serial.println("\nstatus=IDLE");

    if(started)
    {
        if (sms.SendSMS("+19569758590", "Arduino SMS"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }     
    }
};

void loop()
{
    if(started)
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position)
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }     
        delay(2000);
    }
};

TolpuddleSartre

If you look at the example code you based your sketch on,  you need to compare the call to the GetSMS function in the example with your call to the same function.

The compiler has already given you plenty of clues.

ArduinoNoobNeedHelp

so would i add call into this code: sms.GetSMS(sms_position, phone_number, sms_text, 100);

i am sorry but i am a complete beginner at this  :'(

TolpuddleSartre

That's just four arguments again (count them), and the compiler doesn't like it.

ArduinoNoobNeedHelp

Ok so my goal here is to try to text and call a number by the way lol.

So I updated my code:

#include <call.h>
#include <gps.h>
#include <GSM.h>
#include <HWSerial.h>
#include <inetGSM.h>
#include <LOG.h>
#include <SIM900.h>
#include <sms.h>
#include <Streaming.h>
#include <WideTextFinder.h>


   //////////////////////////////////////////////
  //        Arduino GSM SHIELD SMS            //
 //              Tutorial by                 //
//           http://www.educ8s.tv           //
/////////////////////////////////////////////


#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
#include <call.h>
SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
    Serial.begin(9600);
   
    if (gsm.begin(9600))
    {
        Serial.println("\nstatus=READY");
        started=true;
    }
    else
        Serial.println("\nstatus=IDLE");

    if(started)
    {
        if (sms.SendSMS("+19569758590", "Arduino SMS"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }     
    }
};

void loop()
{
    if(started)
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position)
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(call, sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }     
        delay(2000);
    }
};


and got a different error this time; if you could adress each problem i would greatly appreciate it...i am very sorry for this trouble. Following shows error messages:


C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void setup()':

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:50:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         if (sms.SendSMS("+19569758590", "Arduino SMS"))

                                                      ^

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:50:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void loop()':

SMSSender:70: error: 'call' was not declared in this scope

             sms.GetSMS(call, sms_position, phone_number, sms_text, 100);

                        ^

exit status 1
'call' was not declared in this scope

TolpuddleSartre

You have one error - the others are warning.

The code has a byte variable called "call", but you haven't defined it.
Look again at the example and see how "call" is defined and used.

It may even be a function returning byte.

ArduinoNoobNeedHelp

ah ok

so in the example, i dont think call was used but I am trying to do it by myself

what if I just wanted to send SMS for the first part...like i would like to get that part configured first before going to call...what do i need to do for the sneding messages to work

TolpuddleSartre

I have absolutely no idea - I don't have your hardware, so I don't have the library either

ArduinoNoobNeedHelp

can i send the code for just the SMS and you can let me know what I am doing wrong?

so this is code for just sms:



   //////////////////////////////////////////////
  //        Arduino GSM SHIELD SMS            //
 //              Tutorial by                 //
//           http://www.educ8s.tv           //
/////////////////////////////////////////////


#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
    Serial.begin(9600);
   
    if (gsm.begin(9600))
    {
        Serial.println("\nstatus=READY");
        started=true;
    }
    else
        Serial.println("\nstatus=IDLE");

    if(started)
    {
        if (sms.SendSMS("+19569758590", "Arduino SMS"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }     
    }
};

void loop()
{
    if(started)
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position)
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }     
        delay(2000);
    }
};




and i get this error:


C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void setup()':

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:39:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         if (sms.SendSMS("+19569758590", "Arduino SMS"))

                                                      ^

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:39:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino: In function 'void loop()':

SMSSender:59: error: no matching function for call to 'SMSGSM::GetSMS(char&, char [20], char [100], int)'

             sms.GetSMS(sms_position, phone_number, sms_text, 100);

                                                                 ^

C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:59:65: note: candidate is:

In file included from C:\Users\Saad\Desktop\EDD\SMSSender\SMSSender.ino:12:0:

C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD/sms.h:12:11: note: char SMSGSM::GetSMS(byte, char*, byte, char*, byte)

      char GetSMS(byte position, char *phone_number,byte max_phone_len, char *SMS_text, byte max_SMS_len);

           ^

C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD/sms.h:12:11: note:   candidate expects 5 arguments, 4 provided

Multiple libraries were found for "SIM900.h"
 Used: C:\Users\Saad\Documents\Arduino\libraries\SIM900
 Not used: C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD
exit status 1
no matching function for call to 'SMSGSM::GetSMS(char&, char [20], char [100], int)'


i copied exactly from the video example i dont know why i am getting an error?

TolpuddleSartre

We seem to be back where we started.
The function GetSMS expects/requires five arguments, and you're giving it four.

ArduinoNoobNeedHelp

how can i get it to only require four arguments or what is the fifth argument that i need to add?

TolpuddleSartre

Please, just post the example code you based this on, but please use code tags this time.

ArduinoNoobNeedHelp

this is the link for the example code i used: http://educ8s.tv/arduino-gsm-shield/

the example code is in there unless you want me to post it here though i do not know how to used code tags

<code>
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
    Serial.begin(9600);
   
    if (gsm.begin(9600))
    {
        Serial.println("\nstatus=READY");
        started=true;
    }
    else
        Serial.println("\nstatus=IDLE");

    if(started)
    {
        if (sms.SendSMS("+300000000000", "Arduino SMS"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }     
    }
};

void loop()
{
    if(started)
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position)
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }     
        delay(2000);
    }
};
<code>

Go Up