I have an arduino uno board. I have interfaced it with gps SIM28ML and gsm SIM900A and a 16x2 lcd. I have to design a vehicle tracking system that will read the coordinates through gps and will display those on lcd and send to the registered mobile no. through gsm. The program wworked fine for gps and lcd as it fetched and displaed the location and time. But when the code for gsm was writte, it wouldn't compile..showing following error message...
Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
(.text+0x0): multiple definition of `__vector_3'
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
(.text+0x0): multiple definition of `__vector_4'
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
(.text+0x0): multiple definition of `__vector_5'
libraries\SoftwareSerial\SoftwareSerial.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.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
THE CODE FOR THE PROGRAM IS GIVEN BELOW:
#include <SoftwareSerial.h> //include the software serial library
#include <TinyGPS.h> //include the tiny gps library
#include <LiquidCrystal.h> //include the liquid crystal library
#include <GSM.h> //include the gsm library
SoftwareSerial mySerial(2,3); //define the rx and tx of the new serial port
TinyGPS gps; //create gps object
LiquidCrystal lcd(4,5,6,7,8,9); //creating lcd object and defining(rs,en,db4,db5,db6,db7)
//variables for gsm
int temp=0; //variable for storing status of the message received
boolean flag=1; //variable for storing status of the AT commands availability
boolean echo=1; //variable for storing status of ECHO
boolean network=1; //variable for storing status of network
//variables for gps
int year;
long lat,lon,fix_age; //declare long type variable to store lat and long
byte month,date,hour,mins,sec,hundredths; //declare date and time variable
int latdeg; //will store deg of latitude
int latmin; //will store min of latitude
int latsec; //will store seconds of latitude
int londeg; //will store deg of longitude
int lonmin; //will store min of longitude
int lonsec; //will store sec of lonitude
void setup() {
Serial.begin(9600); //initiate the inbuilt serial port
mySerial.begin(9600); //initiate the new serial port
lcd.begin(16,2); //declaring that the lcd is 16x2
lcd.clear();
gsm_start(); //calling the function that will initialise the gsm and get it ready
lcd.clear();
Serial.println("AT+CNMI=2,2,0,0,0");
lcd.clear();
lcd.setCursor(0,0); //setting cursor to beginning
lcd.print("Getting Location");
lcd.setCursor(0,1);
lcd.print("Please Wait");
delay(1000);
}
void loop() {
while(Serial.available())
{
if (Serial.find("Track vehicle")) //compare the received message to turn the system on
{
temp=1;
break;
}
else
temp=0;
}
if(temp) //activating the system only when message is received
{
while (mySerial.available()) //check for the availablty of data in gps rx
{
if (gps.encode(mySerial.read())) //read and encode data
{
gps.get_position(&lat,&lon); //fetch position and store in lat & lon
gps.crack_datetime(&year,&month,&date,&hour,&mins,&sec,&hundredths,&fix_age);
latdeg=lat/1000000; //getting degree of latitude
lat=lat%1000000;
latmin=lat/10000; //getting min of latitude
lat=lat%10000;
latsec=lat/100; //getting the seconds
londeg=lon/1000000; //getting degree of longitude
lon=lon%1000000;
lonmin=lon/10000; //getting min of longitude
lon=lon%10000;
lonsec=lon/100; //getting the seconds
//print the position on lcd
lcd.clear(); //clear lcd
lcd.setCursor(0,0); //set cursor to home
lcd.print("Current position");
lcd.setCursor(0,1);
lcd.print("of the vehicle: ");
delay(2000);
//print coordinates
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" LATITUDE:");
lcd.setCursor(0,1);
lcd.print(latdeg); //print latdeg
lcd.print("deg ");
lcd.print(latmin); //print latmin
lcd.print("mi ");
lcd.print(latsec); //print latsec
lcd.print("sec");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" LONGITUDE:");
lcd.setCursor(0,1);
lcd.print(londeg); //print londeg
lcd.print("deg ");
lcd.print(lonmin); //print lonmin
lcd.print("mi ");
lcd.print(lonsec); //print lonsec
lcd.print("sec ");
delay(2000);
//print time
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" TIME (GMT): ");
lcd.setCursor(0,1);
lcd.print(hour); //print the time
lcd.print("hr ");
lcd.print(mins);
lcd.print("min ");
lcd.print(sec);
lcd.print("sec ");
delay(2000);
lcd.clear();
//print message
lcd.setCursor(0,0);
lcd.print("Take Action");
lcd.setCursor(0,1);
lcd.print("QUICKLY!!!!");
delay(2000);
//sending the data to the mobile phone
Serial.println("AT+CMGF=1");
delay(400);
Serial.println("AT+CMGS="+919775037913"");
delay(400);
send_data("Vehicle Tracking request:");
send_data("The current location of the vehicle is: ");
Serial.print("Latitude: ");
send_value(latdeg);
Serial.print("degree ");
send_value(latmin);
Serial.print("minutes ");
send_value(latsec);
Serial.println("seconds ");
Serial.print("Longitude: ");
send_value(londeg);
Serial.print("degree ");
send_value(lonmin);
Serial.print("minutes ");
send_value(lonsec);
Serial.println("seconds ");
Serial.print("Time tracked(GMT): ");
send_value(hour);
Serial.print("hr ");
send_value(mins);
Serial.print("mins ");
send_value(sec);
Serial.println("sec ");
send_data("Please find me quickly..\nI am here");
send_sms();
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Location sent");
delay(2000);
lcd.clear();
}
}
}
}
//defining the functions used
void gsm_start()
{
//checking the availability of AT commands
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Finding GSM");
while (flag)
{
Serial.println("AT");
while (Serial.available()>0)
{
if (Serial.find("OK"))
flag=0;
}
delay(1000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" GSM READY");
delay(1000);
lcd.clear();
//disabling ECHO
while (echo)
{
Serial.println("ATE0");
while (Serial.available()>0)
{
if (Serial.find("OK"))
echo=0;
}
delay(1000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("ECHO disabled.");
delay(1000);
//finding network
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Finding Network");
while (network);
{
Serial.println("AT+CPIN?");
while (Serial.available()>0)
{
if(Serial.find("+CPIN: READY"))
network=0;
}
delay(1000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Network Found");
delay(1000);
lcd.clear();
}
void send_data(String message)
{
Serial.println(message);
delay(200);
}
void send_value(int value)
{
Serial.println(value);
delay(200);
}
void send_sms()
{
Serial.write(26);
}
WHATS THE MISTAKE? AND WHAT DOES THIS ERROR MEANS? HOPE YOU WILL HELP ME AS IT IS URGENT.