Go Down

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

TolpuddleSartre

Where did you get the library?

Please try to use code tags - it ensures that we can see what you can see.
Their use IS documented - it isn't hard.

ArduinoNoobNeedHelp

so i tried using the library that they gave in that link but i dont know if it works because their gsm maker is tinysine while mine is SIMCOM. Do you think that could be the problem?

also i used this random library: https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield

but i am still getting the same error

TolpuddleSartre

Here's the example code for the library I asked you to post earlier.
Look, five arguments.
Code: [Select]
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//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 send and receive SMS.

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

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

     if(started) {
          //Enable this two lines if you want to send an SMS.
          //if (sms.SendSMS("3471234567", "Arduino SMS"))
          //Serial.println("\nSMS sent OK");
     }

};

void loop()
{
     if(started) {
          //Read if there are messages on SIM card and print them.
        /**  deprecated method
        if(gsm.readSMS(smsbuffer, 160, n, 20)) {
               Serial.println(n);
               Serial.println(smsbuffer);
          }
          **/
          //get 1st sms
          sms.GetSMS(1,n,20,smsbuffer,160);
          Serial.println(n);
          Serial.println(smsbuffer);
         
          delay(1000);
     }
};

ArduinoNoobNeedHelp

so i copied the code into a new program and I got a bunch load of errors that i cant past them all:

here are some of them:

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `GSM::ComparePhoneNumber(unsigned char, char*)'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::configandwait(char*)'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::readCellData(int&, int&, long&, long&)'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::read()'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::SimpleRead()'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::available()'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::read(char*, int)'

Multiple libraries were found for "SIM900.h"
libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

 Used: C:\Users\Saad\Documents\Arduino\libraries\SIM900
 Not used: C:\Users\Saad\Documents\Arduino\libraries\GSM-GPRS-GPS-Shield-GSMSHIELD
libraries\GSM-GPRS-GPS-Shield-GSMSHIELD\SIM900.cpp.o (symbol from plugin): In function `SIMCOM900::forceON()':

(.text+0x0): multiple definition of `SIMCOM900::WhileSimpleRead()'

libraries\SIM900\SIM900.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.


ArduinoNoobNeedHelp

My bad sorry lol

I actually got the code and everything to work but it does not send a text message
When I open up the serial monitor I get:
DB:NO RESP
DB:NO RESP
DB:NO RESP
Trying to force the baud-rate to 9600

1200
2400
4800
9600
19200
38400
57600
115200
ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

Code: [Select]
#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);
    Serial.println("Serial Started.");
   
    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,20, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }     
        delay(2000);
    }
};

Go Up