Serial Monitor does not print anything

I have problem with my program. It seems whenever I try to run the code and check it in the serial monitor, nothing shows up and codes does not work. The logic seems legit but I don’t know what is wrong with it. Help please.

#include "SIM900.h"
#include <SoftwareSerial.h>

#include "sms.h"
SMSGSM sms;

boolean started = false;
char n[20];
char smsbuffer[160];
char user[] = "09369607964";

String charString = "";

int ClotheslineState = 1;
const int retInput = A0;
const int expInput = A1;
const int retOutput = 4;
const int expOutput = 5;

boolean buffer = true;
/****************************************************************************************************/
void setup(){
  pinMode(retOutput, OUTPUT);
  pinMode(expOutput, OUTPUT);
  delay(1000);
  
  Serial.begin(9600);
  Serial.println("GSM Shield Testing. . .");
  
  if(gsm.begin(9600)){
    Serial.println("status = READY");
    started  = true;
  }
  else Serial.println("status = IDLE");
  
  if(started){
    if(sms.SendSMS(user, "Clothesline Manager Ready. Send 'RET' to retrieve clothes, 'EXP' to expose clothes or 'STS' to check status of clothesline."))
      Serial.println("SMS Sent OK");
  }
  
  while(buffer){
    if(analogRead(retInput) > 3){
      ClotheslineState = 0;
      buffer = false;
    }
    else if(analogRead(expInput) > 3){
      ClotheslineState = 1;
      buffer = false;
    }
  }
}
/****************************************************************************************************/
void loop(){
  
  charString = ""; 
  
  Serial.println("Checking for any messages.");
  if(gsm.readSMS(smsbuffer, 160, n, 20)){
    Serial.println(n);
    Serial.println(smsbuffer);
    
    for(int index = 0; smsbuffer[index] != '\0'; index++){
      int thisChar = smsbuffer[index];
      charString += (char)thisChar;
    }
    charString.toUpperCase();
    
    if(charString == "RET" && ClotheslineState == 1){
      Serial.println("\nRETRIEVE ACTION");
      ClotheslineState = 0;
      digitalWrite(retOutput, HIGH);
      while(analogRead(retInput) < 3);
      digitalWrite(retOutput, LOW);
      sms.SendSMS(user, "Clothes Succesfully Retrieved.");
    }
    
    else if(charString == "EXP" && ClotheslineState == 0){
      Serial.println("\nEXPOSE ACTION");
      ClotheslineState = 1;
      digitalWrite(expOutput, HIGH);
      while(analogRead(expInput) < 3);
      digitalWrite(expOutput, LOW);      
      sms.SendSMS(user, "Clothes Succesfully Exposed.");
    }
    
    else if(charString == "RET" && ClotheslineState == 0){
      Serial.println("\nRETRIEVE FAILED");
      sms.SendSMS(user, "Clothes are already Retrieved.");
    }
    
    else if(charString == "EXP" && ClotheslineState == 1){
      Serial.println("\nEXPOSEE FAILED");
      sms.SendSMS(user, "Clothes are already Exposed.");
    }
    
    else if (charString == "STS"){
      Serial.println("\nSTATUS REQUEST");
      if(ClotheslineState == 0)
        sms.SendSMS(user, "Clothesline is in Retrieve State.");
      else if(ClotheslineState == 1)
        sms.SendSMS(user, "Clothesline is in Expose State.");
    }
    
    else Serial.println("Invalid Code. Nothing to do.");
  }
  
  else if(analogRead(retInput) > 3 && ClotheslineState == 1){
    Serial.println("retInput detected");
    ClotheslineState = 0;
    sms.SendSMS(user, "Clothes Succesfully Retrieved.");
  }
  
  else if(analogRead(expInput) > 3 && ClotheslineState == 0){
    Serial.println("expInput detected");
    ClotheslineState = 1;
    sms.SendSMS(user, "Clothes Succesfully Exposed.");
  }
}
/****************************************************************************************************/

Does this line show up in the Serial Monitor?

Serial.println("GSM Shield Testing. . .");

If it does, then what is it that does not show ?

If it does not, have you managed to get any other program to display text in the Serial Monitor?

...R

What baud rate have you got the Serial monitor set to ?

I got baud rate at 9600 for the serial monitor same with the baud rate i have set.

The first Serial.println(); does not show or pretty there is something messing up my code that the moment I run it, it crashes instantly.

iamgreed28:
The first Serial.println(); does not show or pretty there is something messing up my code that the moment I run it, it crashes instantly.

I don’t know what you mean by “or pretty”

Is there a “new” something messing up the code - or has that been the problem all the time?

Go back to basics. Write a short program that just prints “GSM Shield Testing. . .” and then add a little bit at a time testing at each stage. That way it will be easy to isolate the problem. And, as each piece works, keep a copy of it so you can go back to it if the next addition fails.

…R