Cannot receive message from arduino

I am doing project using light dependent sensor (LDR), arduino UNO and GSM SIM900A.

The project is when LDR value below than 300, it will send multiple SMS on different phone no.

The problem the LDR show the value in serial monitor but no SMS was sent.

Below is the code:

#include <SoftwareSerial.h>
SoftwareSerial SIM900(2,3); //(Rx, Tx) Arduino
int toggle=0;

int sensor = 0;

void setup() {
Serial.begin(9600);
SIM900.begin(19200);
pinMode(A0,INPUT);//ldr input reading
}

void loop() {
sensor=analogRead(A0);
Serial.print("Sensor: ");
Serial.println(sensor);

if(sensor<300 && toggle==0)//ldr dark
{
Serial.println("LDR light value is less than 300");
sendSMS1();
Serial.println("Send SMS 1");
delay(1000);
sendSMS2();
Serial.println("Send SMS 2");
toggle=1;
}

if(sensor>300)
{
toggle=0;
}

}

void sendSMS1()
{
SIM900.print("AT+CMGF=1\r"); // AT command send SMS
delay(100);
SIM900.println("AT + CMGS = "+6*""); // * phone no
delay(100);
SIM900.println("WARNING! PLEASE TAKES AN ACTION IMMEDIATELY."); // Message to send delay(100);
SIM900.println((char)26); // End ATCommand a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(1000); // Delay 1 sec to send sms
SIM900.println("AT+CLTS=1");
SIM900.println("AT+CCLK?");
}

void sendSMS2()
{
SIM900.print("AT+CMGF=1\r"); // AT command send SMS
delay(100);
SIM900.println("AT + CMGS = "+6*""); // * phone no
delay(100);
SIM900.println("WARNING! PLEASE TAKES AN ACTION IMMEDIATELY."); // Message to send
delay(100);
SIM900.println((char)26); // End ATCommand a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(1000); // Delay 1 sec to send sms
SIM900.println("AT+CLTS=1");
SIM900.println("AT+CCLK?");
}

Can anybody tell what mistake I have or what should I do?
I am beginner to arduinos. Please help me if you know what is going on.

The problem the LDR show the value in serial monitor but no SMS was sent.

Forget the complication of reading the LDR, have you written a simple sketch that sends an SMS ?

I don't think we can help you because you haven't provided any of the required Information.

You are sending AT commands to the Software Serial and a SIM900A module. The SIM900A appears to come as a shield or as a module which you connect with wires. Which are you using? We can assume a shield would be properly connected, if you are using wires ... have you attached TX to TX or TX to RX? How is the SIM900 powered?

You are sending to the SIM900 but not reading anything back? Why not? AT commands usually have a Response.

Looking at the datasheet for the SIM900, page 2:

"2.2 Command line
Commands always start with AT (which means ATtention) and finish with a character."

Your code:
SIM900.print("AT+CMGF=1\r"); // AT command send SMS
delay(100);

I don't see any CR...

I have never seen AT commands with a lot of spaces... But I will admit limited experience and a lot of years since then...

I don't see any CR...

Apart from the \r at the end of the initial command and the println() commands on other messages

Try serial.print”your at command” then add separate serial.write(‘\r’) see ifthis will solve the problem.

Agree with Jaba
Where is the feedback? Implement some kind of feedback from that module to see if your messages are getting there and you are getting response.

@UKHeliBob - good catch. My bad. Sometimes I don't see the forest for the trees.

I stand corrected on that part but stand by the rest of my comment.