Using GSM 900A module but error in codes. pl help early

here are error message

:\Users\nitin\AppData\Local\Temp\arduino\sketches\DE3C819AC8FDD4EB126A324FA8F62D6F\libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status

my codes are:-

#include <IRremote.h>
#include <SoftwareSerial.h>
#include <GSM.h>

#define SIM900A ""  // Insert your SIM card PIN if applicable

int receiverPin = 2;    // Pin connected to the IR receiver
IRrecv irrecv(receiverPin);
decode_results results;

int relayPin = 4;       // Pin connected to the relay module
int buzzerPin = 5;      // Pin connected to the buzzer module
int alcoholPin = 3;     // Pin connected to the alcohol sensor

SoftwareSerial mySerial(7, 8); // RX, TX for software serial communication
GSM gsmAccess;
GSM_SMS sms;

char remotePhoneNumber1[] = "+917906593906"; // Replace with first recipient's number
char remotePhoneNumber2[] = "+919982470615"; // Replace with second recipient's number

unsigned long lastIRTime = 0; // To track the last IR signal received time
unsigned long irInterval = 900000; // 15 minutes in milliseconds

void setup() {
  irrecv.enableIRIn();  // Start the IR receiver
  pinMode(relayPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(alcoholPin, INPUT);

  Serial.begin(9600);
  mySerial.begin(9600);

  // Start GSM connection
  while (!gsmAccess.begin(SIM900A)) {
    Serial.println("GSM initialization failed. Check your SIM card or GSM connection.");
    delay(1000);
  }
  Serial.println("GSM initialized");
}

void sendSMS(const char* phoneNumber, const char* message) {
  sms.beginSMS(phoneNumber);
  sms.print(message);
  sms.endSMS();
}

void loop() {
  int alcoholValue = digitalRead(alcoholPin);
  unsigned long currentTime = millis();

  if (alcoholValue == LOW) {
    digitalWrite(relayPin, LOW);    // Deactivate relay
    digitalWrite(buzzerPin, HIGH);  // Activate buzzer

    sendSMS(remotePhoneNumber1, "Jai Hind Sir, The Dvr is drunk");
    sendSMS(remotePhoneNumber2, "Jai Hind Sir, The Dvr is drunk");
  } else {
    if (irrecv.decode(&results)) {
      lastIRTime = currentTime; // Update last IR signal received time
      if (results.value == 0xFFFFFFFF) {
        digitalWrite(relayPin, HIGH);   // Activate relay
        digitalWrite(buzzerPin, LOW);   // Deactivate buzzer
      } else {
        digitalWrite(relayPin, LOW);    // Deactivate relay if unexpected IR code
        digitalWrite(buzzerPin, HIGH);  // Activate buzzer if unexpected IR code
      }
      irrecv.resume(); // Receive the next value
      delay(100);
    } else {
      // Check if 15 minutes have passed without IR signal
      if (currentTime - lastIRTime >= irInterval) {
        sendSMS(remotePhoneNumber1, "Jai Hind Sir, The Dvr is not using Seat belt");
        sendSMS(remotePhoneNumber2, "Jai Hind Sir, The Dvr is not using Seat belt");
      }

      digitalWrite(relayPin, LOW);    // Deactivate relay if no IR signal
      digitalWrite(buzzerPin, HIGH);  // Activate buzzer if no IR signal
    }
  }

  // Virtual serial communication with GSM module
  while (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  while (Serial.available()) {
    mySerial.write(Serial.read());
  }

  delay(100); // Adjust delay if needed
}

What is the problem and I cannot read your error message. Is this a student project?

yes it is

What did the forum guidelines say about uploading error messages so others can read them? Your second post looks exactly like the first. Not readable.

error msg

\Users\nitin\AppData\Local\Temp\arduino\sketches\DE3C819AC8FDD4EB126A324FA8F62D6F\libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status

Turn on verbose and capture the full error message.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.