Hello I kind of in a pinch here, I am doing a project about a car alarm system which sends messages when the vibration sensor triggers. My problem is that I got an error about this:
Arduino: 1.8.4 (Windows 10), Board: "Arduino Uno WiFi"
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_3'
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_5'
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_4'
libraries\GSM\GSM3SoftSerial.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 Uno WiFi.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here is my code :
#include <GSM.h>
#define PINNUMBER XXXX
// gsm and gps...
GSM gsmAccess(true); // this call is to access to the data of the sim from the arduino to the phone.
GSM_SMS sms; // to call in to the phone from the arduino to the phone.e.g its like the use of write() or attach() in terms of servo.
char remoteNumber[20]= "xxxxxxx"; //Phone number
char txtMsg[80]="message here";
int vib=4; // for the vibration sensor which is connected to the digital pin 8 of the arduino
void sendSMS();//function call for the SMS
//the gsm and gps...
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT BT
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#include <Blynk.h>
#include <BlynkSimpleSerialBLE.h>
//for the servo and bluetooth.......
char authtok[] = "xxxxxxxxx"; //blynk auth tok
#include<SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial BT(10, 11); // RX, TX bluetooth
Servo door;//open and close
#define servopin 9
void opens();
void closes();
//void noconnect();
//for the blynks......
BLYNK_WRITE(V6) // loop code for the virtual push button of the app to move the servo
{
int key = param.asInt(); // use to read the logic values of the button thats use in blynk
if (key == 0)
{
closes();
Serial.println(key);
Serial.println("Close");
}
else if( key == 1)
{
opens();
Serial.println(key);
Serial.println("Open");
}
}
void setup()
{
Serial.begin(9600);
BT.begin(9600);
Blynk.begin(BT, authtok);
Serial.println(BT);
door.attach(servopin);//servo pin
door.write(closes);// setup the servo to 0 degrees at start
opens();
closes();
pinMode(vib,INPUT);
Serial.println("Car theft message");
// boolean call to use act as a state if the gsm is connected to the sim
boolean notConnected = true;// if the gsm is not connected to the sim which is stated as 'true'
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected) //its still finding connection
{
//number 0874267530
if(gsmAccess.begin(PINNUMBER)==GSM_READY) // an if statement is use to tell the gsm to make a connection to the sim using the sim pin.
notConnected = false;
//sendSMS();
else
{
Serial.println("Not connected");
delay(500);
}
}
Serial.println("GSM initialized");
sendSMS();
}
void loop()
{
int al;
//alarm sets in
al = digitalRead(vib);
if(al==1)
{
//Turn on Alarm here
digitalWrite(vib,HIGH);
Serial.println(al);
sendSMS();
delay(1000);
}
//alarm is not active
else if(al==0)
{
digitalWrite(vib,LOW);
Serial.println(al);
}
Blynk.run();
}
void opens() //function to move the servot to 90 degrees
{
door.write(90);
}
void closes() //function to move the servo to 0 degrees
{
door.write(0);
}
void sendSMS()
{
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
delay(500);
// this is where it will begin its process of connecting to the phone.
sms.beginSMS(remoteNumber); // this will initiate connecting to the sim
sms.print(txtMsg); //the message that has to be sent to the phone.
sms.endSMS(); // Ends the process
Serial.println("\nCOMPLETE!\n");
}