Hi
I am working on the arduino uno with sim900A model,i am not able to get reply from SIM900 model to arduino serial monitor nor able to send an SMS.Bellow is my code.Please give me solution.
#include<SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX pins
int led= 13;
String str;
//char str;
// serial communication settings
void setup()
{
Serial.begin(9600);
mySerial.begin(9600); // setting the buad rate as 9600
pinMode(led,OUTPUT); // initialize the digital pin as an output.
Serial.println("GSM communication initialization");
mySerial.println("AT"); // activating the gsm module.
delay(500);
mySerial.println("AT+CMGF=1"); // setting the gsm module to sms mode.
delay(500);
Serial.println("serial communication begins");
}
void loop()
{
while(mySerial.available() > 0)
{
str = mySerial.readString();
Serial.print(str);
int data=str.indexOf("hello");
mySerial.println(str);
if(data!=-1)
{
mySerial.println("AT+CMGS="9902062107""); // mobile number
delay(500);
mySerial.println("hello"); // Message contents
delay(500);
mySerial.write(byte(26)); // (signals end of message)
delay(500);
}
}
}