Error: ld returned 1 exit status

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
#include<LiquidCrystal.h>
LiquidCrystal lcd(6,7,8,9,10,11);
char phone_number[] = "9167178956"; //phone number
//intialize the library instances
int temp=0,i=0;
int led=13;
char str[15];
#define RELAY1 4
#define RELAY2 5
#define RELAY3 12
#define RELAY4 13
void setup() {
  lcd.begin(16,2);
  mySerial.begin(9600);// Setting the baud rate of GSM Module
  while (!Serial)
    Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);
  mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
    lcd.setCursor(0,0);
  lcd.print("GSM Control Home");
  lcd.setCursor(0,1);
  lcd.print("   Automaton    ");
  delay(2000);
  lcd.clear();
  lcd.print("Circuit Digest");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("System Ready");
  pinMode(RELAY1, OUTPUT);
  pinMode(RELAY2, OUTPUT);
  pinMode(RELAY3, OUTPUT);
  pinMode(RELAY4, OUTPUT);
}

void SendMessage()
{
  mySerial.println("AT+CMFG=1"); //sets the gsm module in text mode
  mySerial.println("AT+CMGS=\"+919167178956\"\r"); // Replace x with mobile number
  delay(1000);
  mySerial.println("Device ready for use");// The SMS text you want to send
  delay(100);
  mySerial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
}


void RecieveMessage()
{
  mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to recieve a live SMS
  delay(1000);
}

void loop() {
  lcd.setCursor(0,0);
  lcd.print("Fan   Light  TV");
   if (mySerial.available() > 0)
    switch (Serial.read())
    {
      case 's':
        SendMessage();
        break;
      case 'r':
        RecieveMessage();
        break;
    }
  if (mySerial.available() > 0)
    Serial.write(mySerial.read());
  char c;
  if (mySerial.available())
    while (c = mySerial.read())
      if (c == 'fanoff')
      {
        digitalWrite(RELAY1, LOW); //turns off relay1
       lcd.setCursor(13,1); 
       lcd.print("OFF    ");
      delay(200);
} 
    if (c == 'fanon')
   {
    digitalWrite(RELAY1, HIGH); //turns on relay1
  lcd.setCursor(13,1); 
      lcd.print("ON    ");
      delay(200);
}
   if (c == 'lighton')
    {
      digitalWrite(RELAY2, HIGH); //turns on relay2
  lcd.setCursor(13,1); 
      lcd.print("ON    ");
      delay(200);
}
     if (c == 'lightoff')
 {
  digitalWrite(RELAY2, LOW); //turns off relay2
  lcd.setCursor(13,1); 
      lcd.print("OFF    ");
      delay(200);
}
  if (c == 'pc1on')
    {
      digitalWrite(RELAY3, HIGH); //turns on relay3
  lcd.setCursor(13,1); 
      lcd.print("ON    ");
      delay(200);
     }
     if (c == 'pc1off')
  { 
    digitalWrite(RELAY3, LOW); //turns off relay3
  lcd.setCursor(13,1); 
      lcd.print("OFF    ");
      delay(200);
}
  if (c == 'pc2on')
 {
  digitalWrite(RELAY4, HIGH); //turns on relay4
  lcd.setCursor(13,1); 
      lcd.print("ON    ");
      delay(200);
}
   if (c == 'pc2off')
 {
    digitalWrite(RELAY4, LOW); //turns off relay4
  lcd.setCursor(13,1); 
      lcd.print("OFF    ");
      delay(200);
}
  if (c == 'all on')
    {
      digitalWrite(RELAY1, HIGH);
      digitalWrite(RELAY2, HIGH);
      digitalWrite(RELAY3, HIGH);
      digitalWrite(RELAY4,HIGH);
      lcd.setCursor(0,1); 
      lcd.print("ON  ON   ON   ON");
      delay(200);
    }
 
    if (c== 'all off')
    {
      digitalWrite(RELAY1, LOW);
      digitalWrite(RELAY2, LOW);
      digitalWrite(RELAY3, LOW);
      digitalWrite(RELAY4, LOW);
      lcd.setCursor(0,1); 
      lcd.print("OFF  OFF  OFF  OFF ");
      delay(200);
}
}

error:- none but if you can help me to make some changes in the code or reduce the code using other instruction i will be happy and thanks for the suggestions / reply guys :slight_smile:

From my side code is good to work

Clearly, your code is NOT good. If it was, the linker wouldn't be complaining.

You can NOT use SoftwareSerial at the same time you are using GSM.

You have created an instance of the GSM class, but do not appear to use it. Why not? Or, why did you create an instance that you don't intend to use?

What GSM shield do you have?

I also want to know what single character on a keyboard is represented by these:

'fanoff'
'fanon'
'lighton'
'lightoff'
'pc1on'
'pc1off'
'pc2on'
'pc2off'

Paul.S i am a noob at this i have done this programming for the first time of arduino without any guidance. I will make the changes in my coding as you say.

PaulS:
Clearly, your code is NOT good. If it was, the linker wouldn’t be complaining.

You can NOT use SoftwareSerial at the same time you are using GSM.

You have created an instance of the GSM class, but do not appear to use it. Why not? Or, why did you create an instance that you don’t intend to use?

What GSM shield do you have?

I am clearly a noob at this i have done programming for arduino for the first time. I will do the necessary changes as you say and thanks for a reply.

Take a look at the compiler output in your first post. Do you see the smiley faces? They are because the forum software saw some parts of the output as forum markup. This is one of the reasons why we have a rule here that all code, warning, and error messages must be put in code tags.

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

PaulS:
Clearly, your code is NOT good. If it was, the linker wouldn’t be complaining.

You can NOT use SoftwareSerial at the same time you are using GSM.

You have created an instance of the GSM class, but do not appear to use it. Why not? Or, why did you create an instance that you don’t intend to use?

What GSM shield do you have?

Thanks buddy for your hint i deleted gsm library and changed my code like this if you would like to give some more suggestions or comment on my code i would like to have it and thanks no error now plz reply if you i can modify this code more
:-
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
#include<LiquidCrystal.h>
LiquidCrystal lcd(6,7,8,9,10,11);
char phone_number = “9167178956”; //phone number
//intialize the library instances
int temp=0,i=0;
int led=13;
char str[15];
#define RELAY1 4
#define RELAY2 5
#define RELAY3 12
#define RELAY4 13
void setup() {
lcd.begin(16,2);
mySerial.begin(9600);// Setting the baud rate of GSM Module
while (!Serial)
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
mySerial.println(“AT+CMGF=1”); //Sets the GSM Module in Text Mode
lcd.setCursor(0,0);
lcd.print(“GSM Control Home”);
lcd.setCursor(0,1);
lcd.print(" Automaton ");
delay(2000);
lcd.clear();
lcd.print(“Circuit Digest”);
delay(1000);
lcd.setCursor(0,1);
lcd.print(“System Ready”);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
}

void SendMessage()
{
mySerial.println(“AT+CMFG=1”); //sets the gsm module in text mode
mySerial.println(“AT+CMGS=”+919167178956"\r"); // Replace x with mobile number
delay(1000);
mySerial.println(“Device ready for use”);// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}

void RecieveMessage()
{
mySerial.println(“AT+CNMI=2,2,0,0,0”); // AT Command to recieve a live SMS
delay(1000);
}

void loop() {
lcd.setCursor(0,0);
lcd.print(“Fan Light TV”);
if (mySerial.available() > 0)
switch (Serial.read())
{
case ‘s’:
SendMessage();
break;
case ‘r’:
RecieveMessage();
break;
}
if (mySerial.available() > 0)
Serial.write(mySerial.read());
char c;
if (mySerial.available())
while (c = mySerial.read())
if (c == ‘fanoff’)
{
digitalWrite(RELAY1, LOW); //turns off relay1
lcd.setCursor(13,1);
lcd.print("OFF ");
delay(200);
}
if (c == ‘fanon’)
{
digitalWrite(RELAY1, HIGH); //turns on relay1
lcd.setCursor(13,1);
lcd.print("ON ");
delay(200);
}
if (c == ‘lighton’)
{
digitalWrite(RELAY2, HIGH); //turns on relay2
lcd.setCursor(13,1);
lcd.print("ON ");
delay(200);
}
if (c == ‘lightoff’)
{
digitalWrite(RELAY2, LOW); //turns off relay2
lcd.setCursor(13,1);
lcd.print("OFF ");
delay(200);
}
if (c == ‘pc1on’)
{
digitalWrite(RELAY3, HIGH); //turns on relay3
lcd.setCursor(13,1);
lcd.print("ON ");
delay(200);
}
if (c == ‘pc1off’)
{
digitalWrite(RELAY3, LOW); //turns off relay3
lcd.setCursor(13,1);
lcd.print("OFF ");
delay(200);
}
if (c == ‘pc2on’)
{
digitalWrite(RELAY4, HIGH); //turns on relay4
lcd.setCursor(13,1);
lcd.print("ON ");
delay(200);
}
if (c == ‘pc2off’)
{
digitalWrite(RELAY4, LOW); //turns off relay4
lcd.setCursor(13,1);
lcd.print("OFF ");
delay(200);
}
if (c == ‘all on’)
{
digitalWrite(RELAY1, HIGH);
digitalWrite(RELAY2, HIGH);
digitalWrite(RELAY3, HIGH);
digitalWrite(RELAY4,HIGH);
lcd.setCursor(0,1);
lcd.print(“ON ON ON ON”);
delay(200);
}

if (c== ‘all off’)
{
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, LOW);
digitalWrite(RELAY3, LOW);
digitalWrite(RELAY4, LOW);
lcd.setCursor(0,1);
lcd.print("OFF OFF OFF OFF ");
delay(200);
}
}

pert:
Take a look at the compiler output in your first post. Do you see the smiley faces? They are because the forum software saw some parts of the output as forum markup. This is one of the reasons why we have a rule here that all code, warning, and error messages must be put in code tags.

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

if you would like to give some more suggestions or comment on my cod

Until you learn to use code tags, I’m not reading your posts, or commenting any more.

pert:

thanks for suggesting me for using code tags

PaulS:
Until you learn to use code tags, I'm not reading your posts, or commenting any more.

i have modified my post you can now check it and thanks for your reply

Shaikh_Junaid:
i have modified my post

Nope