What is the wrong with my program ??

I'm new with Arduino
What I am trying to build, is a Speed limit notification system that can sense my location and speed using GPS module then compare it to defined speed for the current road using algorithm then send data over GSM network to my mobile phone warning me if i exceed the speed limit .

  1. Arduino Uno

  2. GPS module because
    محل Zero Ohm للإلكترونيات • رفيق

  3. GSM shield for network connection or sms sending

I connect the gps module to uno and works fine and same for gsm shield but when I tried to connect all of the parts together and Merge the two program I got this error

Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

from C:\Users\Mohammad\Desktop\Final2\Final2.ino:16:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration [enabled by default]

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

^

C:\Users\Mohammad\Desktop\Final2\Final2.ino: In function 'void setup()':

C:\Users\Mohammad\Desktop\Final2\Final2.ino:121:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if(gsmAccess.begin(PINNUMBER)==GSM_READY)

^

libraries\GSM\GSM3SoftSerial.cpp.o: In function `__vector_3':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:499: multiple definition of `__vector_3'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:229: first defined here

libraries\GSM\GSM3SoftSerial.cpp.o: In function `GSM3SoftSerial::spaceAvailable()':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:487: multiple definition of `__vector_4'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: first defined here

libraries\GSM\GSM3SoftSerial.cpp.o: In function `GSM3SoftSerial::spaceAvailable()':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:487: multiple definition of `__vector_5'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

the program is attached
plz any help and sorry about my english

123.txt (9.28 KB)

#include <SoftwareSerial.h>

Forget it. You can't use SoftwareSerial and the GSM library in the same sketch.

Get a Mega.

PaulS:

#include <SoftwareSerial.h>

Forget it. You can't use SoftwareSerial and the GSM library in the same sketch.

Get a Mega.

Actually the both is not working at the same time is there any tricks to connect to GSM then after I finish disconnect then use softwareserial ,
if not the only solution is Mega ?

Actually the both is not working at the same time is there any tricks to connect to GSM then after I finish disconnect then use softwareserial ,

Well, OK. After getting data from the phone, you can load a new sketch that uses SoftwareSerial. When that is done, load the first sketch that uses GSMSoftwareSerial. Repeat until you get tired of that.

Then, get a Mega.

I bought now the mega I am getting this error

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

from C:\Users\Mohammad\Desktop\Final2\Final2.ino:16:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration [enabled by default]

typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

^

libraries\GSM\GSM3SoftSerial.cpp.o: In function `__vector_9':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:499: multiple definition of `__vector_9'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:229: first defined here

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

libraries\GSM\GSM3SoftSerial.cpp.o: In function `GSM3SoftSerial::spaceAvailable()':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:487: multiple definition of `__vector_10'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: first defined here

libraries\GSM\GSM3SoftSerial.cpp.o: In function `GSM3SoftSerial::spaceAvailable()':

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3SoftSerial.cpp:487: multiple definition of `__vector_11'

libraries\SoftwareSerial\SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

And what changes have you made to your sketch?

G

I bought now the mega I am getting this error

The official GSM library uses SoftwareSerial, so it is not designed for use on the Mega.

I comment out serial //SoftwareSerial mySerial(3, 2);
then I used HardwareSerial mySerial = Serial1;

Adafruit_GPS GPS(&Serial1);


#include <Adafruit_GPS.h>
//#include <SoftwareSerial.h>
#include <GSM.h>
#define PINNUMBER ""
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;
char txtMsg[200]={"Test"};
// If you're using a GPS module:
// Connect the GPS Power pin to 5V
// Connect the GPS Ground pin to ground
// If using software serial (sketch example default):
// Connect the GPS TX (transmit) pin to Digital 3
// Connect the GPS RX (receive) pin to Digital 2
// If using hardware serial (e.g. Arduino Mega):
// Connect the GPS TX (transmit) pin to Arduino RX1, RX2 or RX3
// Connect the GPS RX (receive) pin to matching TX1, TX2 or TX3

// If you're using the Adafruit GPS shield, change
// SoftwareSerial mySerial(3, 2); -> SoftwareSerial mySerial(8, 7);
// and make sure the switch is set to SoftSerial

// If using software serial, keep this line enabled
// (you can change the pin numbers to match your wiring):
//SoftwareSerial mySerial(3, 2);

// If using hardware serial (e.g. Arduino Mega), comment out the
// above SoftwareSerial line, and enable this line instead
// (you can change the Serial number to match your wiring):

HardwareSerial mySerial = Serial1;

Adafruit_GPS GPS(&Serial1);

PaulS:
The official GSM library uses SoftwareSerial, so it is not designed for use on the Mega.

so what I have to do plz !

Look for all the calls to SoftwareSerial functions in the GSM library, and replace them with equivalent calls to another serial port.

Can't you use the software serial for the GSM module and the hardware serial for the GPS?? I don't know if there are GPS library's on hardware serial, but I've written my own GPS program over hardware serial so i'm a 100% sure that'll work. Making such a program isn't easy, but it can be done. The hardest part is interpreting the raw NMEA data. I am quite sure that you will be able to make your project with the items you have right now

Jasper

so what I have to do plz !

Lodge a complaint with the Arduino team. Nothing will happen, but perhaps you'll feel better.